Merge pull request #24002 from frederic34/patch-5

utf8_decode and utf8_encode are deprecated
This commit is contained in:
Laurent Destailleur 2023-02-22 19:39:04 +01:00 committed by GitHub
commit a17bcd1768
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -13,7 +13,7 @@
* Copyright (C) 2014 Cédric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2018-2022 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2023 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019-2022 Thibault Foucart <support@ptibogxiv.net>
* Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
@ -8890,7 +8890,7 @@ function dol_osencode($str)
}
if ($tmp == 'iso-8859-1') {
return utf8_decode($str);
return mb_convert_encoding($str, 'ISO-8859-1', 'UTF-8');
}
return $str;
}

View File

@ -178,9 +178,9 @@ function dol_print_file($langs, $filename, $searchalt = 0)
$content = file_get_contents($formfilealt);
$isutf8 = utf8_check($content);
if (!$isutf8 && $conf->file->character_set_client == 'UTF-8') {
print utf8_encode($content);
print mb_convert_encoding($content, 'UTF-8', 'ISO-8859-1');
} elseif ($isutf8 && $conf->file->character_set_client == 'ISO-8859-1') {
print utf8_decode($content);
print mb_convert_encoding($content, 'ISO-8859-1', 'UTF-8');
} else {
print $content;
}