[Melbourne-pm] Decoding =?ISO-8859-1...
brendon.oliver at gmail.com
Sat Jul 19 15:37:50 PDT 2008
Nathan Bailey wrote:
> I know this should be trivial, but for some reason, I can't change:
> =?ISO-8859-1?B?MEY1NzYzMSAwNy8xNi8yMDA4?= =?ISO-8859-1?B?IDE1OjMz?=
> into "Scanned from MFP-00F57631 07/16/2008 15:33"
> I've tried just decoding ISO-8859-1, I've tried decoding and
> re-encoding as utf8, and I've even tried Unicode::String, but I still
> seem to end up with the same input as output.
I'm pretty sure that this format of subject line needs to be read as:
where if encoding = B, 'subj_string' is base64 encoded, so you need to
decode 'subj_string' from base64 first before you do any character set
conversions with 'charset'.
I maintain an in-house mailer program that frequently must handle
double-byte Japanese & Chinese subject lines and found I had to do
something like this (for example) in order to construct a subject line
that was readable in Japanese/Chinese mail clients:
encode $subj_string from utf8 -> shiftjis or gb2312
$subject = sprintf('=?%s?B?%s?=', $charset, $subj_string)
I couldn't find anything that would do the properly-formatted encoding
of subject string (so if you can find something which will do the
encoding in either direction, that'd be great!).
Hope this helps.
More information about the Melbourne-pm