diff --git a/CHANGELOG.md b/CHANGELOG.md index bfad0b8..74f9dc4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,10 @@ All notable changes to this project will be documented in this file, in reverse ### Fixed +- [#26](https://github.com/zendframework/zend-mime/pull/26) ensures commas + included within list data items are ASCII encoded, ensuring that the items + will split on commas correctly (instead of splitting within an item). + - [#30](https://github.com/zendframework/zend-mime/pull/30) fixes how EOL characters are detected, to ensure that mail using `\r\n` as an EOL sequence (including mail emitted by Cyrus and Dovecot) will be properly parsed. diff --git a/src/Mime.php b/src/Mime.php index 8378033..27a000e 100644 --- a/src/Mime.php +++ b/src/Mime.php @@ -193,7 +193,7 @@ public static function encodeQuotedPrintableHeader( $str = self::_encodeQuotedPrintable($str); // Mail-Header required chars have to be encoded also: - $str = str_replace(['?', ' ', '_'], ['=3F', '=20', '=5F'], $str); + $str = str_replace(['?', ',', ' ', '_'], ['=3F', '=2C', '=20', '=5F'], $str); // initialize first line, we need it anyways $lines = [0 => '']; diff --git a/test/MimeTest.php b/test/MimeTest.php index f906e9f..6e79268 100644 --- a/test/MimeTest.php +++ b/test/MimeTest.php @@ -131,7 +131,7 @@ public static function dataTestEncodeMailHeaderQuotedPrintable() ["äöü", "UTF-8", "=?UTF-8?Q?=C3=A4=C3=B6=C3=BC?="], ["äöü ", "UTF-8", "=?UTF-8?Q?=C3=A4=C3=B6=C3=BC?="], ["Gimme more €", "UTF-8", "=?UTF-8?Q?Gimme=20more=20=E2=82=AC?="], - ["Alle meine Entchen schwimmen in dem See, schwimmen in dem See, Köpfchen in das Wasser, Schwänzchen in die Höh!", "UTF-8", "=?UTF-8?Q?Alle=20meine=20Entchen=20schwimmen=20in=20dem=20See,=20?=\n =?UTF-8?Q?schwimmen=20in=20dem=20See,=20K=C3=B6pfchen=20in=20das=20?=\n =?UTF-8?Q?Wasser,=20Schw=C3=A4nzchen=20in=20die=20H=C3=B6h!?="], + ["Alle meine Entchen schwimmen in dem See, schwimmen in dem See, Köpfchen in das Wasser, Schwänzchen in die Höh!", "UTF-8", "=?UTF-8?Q?Alle=20meine=20Entchen=20schwimmen=20in=20dem=20See=2C=20?=\n =?UTF-8?Q?schwimmen=20in=20dem=20See=2C=20K=C3=B6pfchen=20in=20das=20?=\n =?UTF-8?Q?Wasser=2C=20Schw=C3=A4nzchen=20in=20die=20H=C3=B6h!?="], ["ääääääääääääääääääääääääääääääääää", "UTF-8", "=?UTF-8?Q?=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4?="], ["A0", "UTF-8", "=?UTF-8?Q?A0?="], ["äääääääääääääää ä", "UTF-8", "=?UTF-8?Q?=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=C3=A4=20?=\n =?UTF-8?Q?=C3=A4?="],