Skip to content

Commit d5938dd

Browse files
committed
Support to multibyte in subject.
1 parent c48db36 commit d5938dd

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/Cake/Network/CakeEmail.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ public function subject($subject = null) {
475475
if ($subject === null) {
476476
return $this->_subject;
477477
}
478-
$this->_subject = (string)$subject;
478+
$this->_subject = $this->_encode((string)$subject);
479479
return $this;
480480
}
481481

lib/Cake/tests/Case/Network/CakeEmailTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,10 @@ public function testSubject() {
342342
$result = $this->CakeEmail->subject(array('something'));
343343
$this->assertIdentical($this->CakeEmail->subject(), 'Array');
344344
$this->assertIdentical($this->CakeEmail, $result);
345+
346+
$this->CakeEmail->subject('هذه رسالة بعنوان طويل مرسل للمستلم');
347+
$expected = '=?UTF-8?B?2YfYsNmHINix2LPYp9mE2Kkg2KjYudmG2YjYp9mGINi32YjZitmEINmF2LE=?=' . "\r\n" . ' =?UTF-8?B?2LPZhCDZhNmE2YXYs9iq2YTZhQ==?=';
348+
$this->assertIdentical($this->CakeEmail->subject(), $expected);
345349
}
346350

347351
/**

0 commit comments

Comments
 (0)