From 229e2e8a722cbf681cf2703c62497f065a3d3e91 Mon Sep 17 00:00:00 2001 From: u_mulder Date: Mon, 6 Mar 2023 17:48:54 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20=D0=92=D0=BC=D0=B5=D1=81=D1=82=D0=BE=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=B4=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20?= =?UTF-8?q?=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B8=20=D0=B2=20mb=5Fstring-?= =?UTF-8?q?=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D1=8F=D1=85=20=D0=BB=D0=BE?= =?UTF-8?q?=D0=B2=D0=B8=D0=BC=20=D0=B2=D1=8B=D0=BF=D0=B0=D0=B4=D0=B0=D1=8E?= =?UTF-8?q?=D1=89=D0=B8=D0=B9=20=D1=8D=D0=BA=D1=81=D0=B5=D0=BF=D1=88=D0=B5?= =?UTF-8?q?=D0=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Fetch/Message.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Fetch/Message.php b/src/Fetch/Message.php index 4afb07a..87354bd 100644 --- a/src/Fetch/Message.php +++ b/src/Fetch/Message.php @@ -599,11 +599,18 @@ class Message } $converted = null; - if (!$converted && function_exists('mb_convert_encoding') && @mb_check_encoding($text, $from)) { - $converted = @mb_convert_encoding($text, $to, $from); + if (!$converted && function_exists('mb_convert_encoding')) { + try { + if (mb_check_encoding($text, $from)) { + $converted = mb_convert_encoding($text, $to, $from); + } + } catch (\ValueError $e) { + // noop + } } if (!$converted && function_exists('iconv')) { + // Для `iconv` @ пока работает $converted = @iconv($from, $to . self::$charsetFlag, $text); }