From 962a58301f9f5034b39e5c4316a1898c968b0815 Mon Sep 17 00:00:00 2001 From: DoobleD Date: Fri, 14 Jul 2023 17:32:09 +0200 Subject: [PATCH] fix error mb_convert_encoding(): Argument #3 ($from_encoding) contains invalid encoding "windows-1256" --- src/lib/utils/utils.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib/utils/utils.php b/src/lib/utils/utils.php index e6826f75..d4b5d8e1 100644 --- a/src/lib/utils/utils.php +++ b/src/lib/utils/utils.php @@ -1278,7 +1278,11 @@ private static function convertRawHeader2Utf8($nonencstr, $utf8str) { $str .= $val->text; } else { - $str .= @mb_convert_encoding($val->text, "utf-8", $val->charset); + try { + $str .= @mb_convert_encoding($val->text, "utf-8", $val->charset); + } catch (ValueError $exception) { + $str .= @iconv($val->charset, "utf-8", $val->text); + } } } if (!$isiso2022jp) {