Skip to content

Commit

Permalink
Merge branch 'cmoralesweb-utf8-body-encoding'
Browse files Browse the repository at this point in the history
  • Loading branch information
ddeboer committed Aug 10, 2014
2 parents b9ea123 + 21f3817 commit 14be6ee
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Ddeboer/Imap/Message/Part.php
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
21 changes: 20 additions & 1 deletion tests/Ddeboer/Imap/Tests/MessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand All @@ -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"
. "<html><body>Espa=F1a</body></html>\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("<html><body>España</body></html>\r\n", $message->getBodyHtml());
}

public function testBcc()
{
$raw = "Subject: Undisclosed recipients\r\n";
Expand Down

0 comments on commit 14be6ee

Please sign in to comment.