From 366c5dc189b7fda8b62d50ad99898de13cfec3a0 Mon Sep 17 00:00:00 2001 From: Sergey Linnik Date: Tue, 7 Mar 2017 18:13:26 +0300 Subject: [PATCH] Fix all non utf8 strings --- src/Fetch/Message.php | 4 ++++ tests/Fetch/Test/MIMETest.php | 4 ++++ 2 files changed, 8 insertions(+) mode change 100755 => 100644 src/Fetch/Message.php diff --git a/src/Fetch/Message.php b/src/Fetch/Message.php old mode 100755 new mode 100644 index dc76535..27c3dc8 --- a/src/Fetch/Message.php +++ b/src/Fetch/Message.php @@ -597,6 +597,10 @@ class Message return $converted; } + if ($to === 'utf-8') { + return UTF8::fix($text); + } + return null; } diff --git a/tests/Fetch/Test/MIMETest.php b/tests/Fetch/Test/MIMETest.php index 3fc8c26..1685f5c 100644 --- a/tests/Fetch/Test/MIMETest.php +++ b/tests/Fetch/Test/MIMETest.php @@ -34,6 +34,10 @@ class MIMETest extends \PHPUnit_Framework_TestCase . PHP_EOL . '=?ISO-8859-2?B?dSB1bmRlcnN0YW5kIHRoZSBleGFtcGxlLg==?=' ), + array( + 'ab11 ? ?????.jpg', + "\x61\x62\x31\x31\x20\x97\x20\x3f\x3f\x3f\x3f\x3f\x2e\x6a\x70\x67", + ), array( '?????? ?????.pdf', '=?UTF-8?B?' .base64_encode("\xCF\xF0\xE8\xEC\xE5\xF0 \xEF\xEB\xE0\xED\xE0\x2E\x70\x64\x66") . '?=',