diff --git a/src/Ddeboer/Imap/Message/Part.php b/src/Ddeboer/Imap/Message/Part.php index 9e68a6c3..4f0ba79a 100644 --- a/src/Ddeboer/Imap/Message/Part.php +++ b/src/Ddeboer/Imap/Message/Part.php @@ -154,7 +154,7 @@ public function getDecodedContent() break; case self::ENCODING_QUOTED_PRINTABLE: - $this->decodedContent = \utf8_encode( \quoted_printable_decode($this->getContent())); + $this->decodedContent = \utf8_encode(\quoted_printable_decode($this->getContent())); break; case self::ENCODING_7BIT: diff --git a/tests/Ddeboer/Imap/Tests/MessageTest.php b/tests/Ddeboer/Imap/Tests/MessageTest.php index 686a5377..fa60c181 100644 --- a/tests/Ddeboer/Imap/Tests/MessageTest.php +++ b/tests/Ddeboer/Imap/Tests/MessageTest.php @@ -38,7 +38,7 @@ public function testKeepUnseen() $this->assertFalse($message->isSeen()); } - public function testSubjectEncoding() + public function testEncoding7Bit() { $this->createTestMessage($this->mailbox, 'lietuviškos raidės', 'lietuviškos raidės'); @@ -47,6 +47,25 @@ public function testSubjectEncoding() $this->assertEquals('lietuviškos raidės', $message->getBodyText()); } + public function testEncodingQuotedPrintable() + { + $boundary = 'Mailer=123'; + $raw = "Subject: ESPAÑA\r\n" + . "Content-Type: multipart/alternative; boundary=\"$boundary\"\r\n" + . "--$boundary\r\n" + . "Content-Transfer-Encoding: quoted-printable\r\n" + . "Content-Type: text/html\r\n\tcharset=\"windows-1252\"\r\n" + . "\r\n" + . "Espa=F1a\r\n\r\n" + . "--$boundary--\r\n\r\n"; + + $this->mailbox->addMessage($raw); + + $message = $this->mailbox->getMessage(1); + $this->assertEquals('ESPAÑA', $message->getSubject()); + $this->assertEquals("España\r\n", $message->getBodyHtml()); + } + public function testBcc() { $raw = "Subject: Undisclosed recipients\r\n";