UTF8 encoding of subject line broken
ralphb - May 29, 2006 - 19:07
| Project: | Simplenews |
| Version: | HEAD |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
The title of the newsletter is not being encoded correctly, as the conversion of UTF8 into quoted printable (=xx) and the encapsulation into =?utf-8?Q?...= is missing.
For example, a subject of "Jörg" should be encoded as "=?utf-8?Q?J=c3=b6rg?=", but isn't.

#1
After reading through the PHP documentation and the activeMail code it seems that an RFC-compliant solution is currently not possible (this would involve a multi-line subject header, see RFC 2047). In the interim, we could at least use some proper encoding but keep everything in one single line:
function sn_mail_enc_subj($subject) {$escd = preg_replace('/[^\x09\x20-\x3C\x3E-\x7E]/e',
'sprintf("=%02X", ord("$0"));', $subject);
$escd = str_replace(' ', '_', $escd);
return "=?utf-8?q?" . $escd . "?=";
}
Then replace
$email->Subject($mail->title);by
$email->Subject(sn_mail_enc_subj($mail->title));This fixes display issues in at least mutt and Thunderbird (on OSX).
#2
Is this still open??
#3
Issue closed. No response for too long time.