The following code illustrates the weirdness:
<?php
require_once __DIR__.'/vendor/autoload.php';
use Zend\Mime\Mime;
$str = '=?iso-8859-1?Q?Jorgen?= <foo1@example.com>,=?iso-8859-1?Q?Schmorgen?= <foo2@example.com>';
$header = iconv_mime_decode($str);
$encoded = Mime::encodeQuotedPrintableHeader($header, 'UTF-8', 78, "\r\n");
echo $encoded;
The output:
=?UTF-8?Q?Jorgen=20<foo1@example.com>,Schmorgen=20<foo2@example.com>?=
This is a problem now that zend-mail explodes the whole encoded string on a comma to due to this:
zendframework/zend-mail#44
Which results in the prefix and suffix being split up, breaking the parsing of the header.
The RFCs don't seem to be clear about whether the header field separator is allowed in the middle of a quoted-printable string, but do say that it should only be used if necessary for a given token.
The following code illustrates the weirdness:
The output:
This is a problem now that zend-mail explodes the whole encoded string on a comma to due to this:
zendframework/zend-mail#44
Which results in the prefix and suffix being split up, breaking the parsing of the header.
The RFCs don't seem to be clear about whether the header field separator is allowed in the middle of a quoted-printable string, but do say that it should only be used if necessary for a given token.