From d9fda122ff0d22d7748b2409027c11f6c1242944 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 22 Feb 2023 18:14:44 +0100 Subject: [PATCH 1/3] utf8_decode is deprecated --- htdocs/core/lib/functions.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 4345c936432..61324e4ce9e 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -13,7 +13,7 @@ * Copyright (C) 2014 Cédric GROSS * Copyright (C) 2014-2015 Marcos García * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2018-2022 Frédéric France + * Copyright (C) 2018-2023 Frédéric France * Copyright (C) 2019-2022 Thibault Foucart * Copyright (C) 2020 Open-Dsi * Copyright (C) 2021 Gauthier VERDOL @@ -8890,7 +8890,7 @@ function dol_osencode($str) } if ($tmp == 'iso-8859-1') { - return utf8_decode($str); + return mb_convert_encoding($str, 'UTF-8', 'ISO-8859-1'); } return $str; } From ed046e16d2536ab77cec3dd1ac6c48834d4780a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 22 Feb 2023 18:21:00 +0100 Subject: [PATCH 2/3] Update functions2.lib.php --- htdocs/core/lib/functions2.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 6b51cf76150..188b30116d7 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -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; } From ee95ac237c57142ca5a135c1efcc4caef5455c12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 22 Feb 2023 18:21:58 +0100 Subject: [PATCH 3/3] Update functions.lib.php --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 61324e4ce9e..e6ac7f2d9f2 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8890,7 +8890,7 @@ function dol_osencode($str) } if ($tmp == 'iso-8859-1') { - return mb_convert_encoding($str, 'UTF-8', 'ISO-8859-1'); + return mb_convert_encoding($str, 'ISO-8859-1', 'UTF-8'); } return $str; }