From fc2958538c7c18cd09c5a46d8453fe47db8b05cb Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Mon, 17 Oct 2022 09:26:00 +0200 Subject: [PATCH] Bugfix: imap_mutf7_to_utf8 is broken for U+10000 and up --- snappymail/v/0.0.0/app/libraries/MailSo/Base/Utils.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Base/Utils.php b/snappymail/v/0.0.0/app/libraries/MailSo/Base/Utils.php index e0ef62a70..b92432a71 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Base/Utils.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Base/Utils.php @@ -1063,10 +1063,9 @@ abstract class Utils public static function Utf7ModifiedToUtf8(string $sStr) : string { - $sResult = \is_callable('imap_mutf7_to_utf8') - ? \imap_mutf7_to_utf8($sStr) -// : \mb_convert_encoding($sStr, 'UTF-8', 'UTF7-IMAP'); - : static::MbConvertEncoding($sStr, 'UTF7-IMAP', 'UTF-8'); + // imap_mutf7_to_utf8() is broken and doesn't support U+10000 and up, + // thats why mmb_convert_encoding is used + $sResult = static::MbConvertEncoding($sStr, 'UTF7-IMAP', 'UTF-8'); // ucnv U_FILE_ACCESS_ERROR // $sResult = \UConverter::transcode($sStr, \UConverter::UTF8, \UConverter::IMAP_MAILBOX, ['to_subst' => '�']); return (false === $sResult) ? $sStr : $sResult;