[Melbourne-pm] Decoding =?ISO-8859-1...
Nathan Bailey
Nathan.Bailey at its.monash.edu
Sun Jul 20 00:30:08 PDT 2008
Stephen, you're a legend - works like a charm :-)
thanks,
N
On 20/07/2008, at 10:40 AM, Stephen Edmonds wrote:
> Nate,
>
> ISO-8859-1 is not the encoding of the subject, it is an indication
> of the encoding of the original string before it was put into MIME
> encoded-word. [1]
>
> You need to use Encode::MIME::Header, but that is simply part of
> Encode so you need to do is:
>
> $text = decode('MIME-Header', $subj)
>
> This gives a text string of the original subject. If you are going
> to transmit it as UTF8 that is when you use decode() to give you a
> binary string from the text string.
>
> Thanks,
>
> Stephen
>
> [1] http://en.wikipedia.org/wiki/MIME#Encoded-Word
>
> Nathan Bailey wrote:
>> I know this should be trivial, but for some reason, I can't change:
>> =?ISO-8859-1?B?U2Nhbm5lZCBmcm9tIE1GUC0w?= =?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.
>> Help? :-)
>> code examples:
>> use Encode;
>> $subj = encode("utf8", decode('ISO-8859-1', $subj));
>> use Unicode::String;
>> Unicode::String->stringify_as( 'utf8' );
>> my $string_utf8 = Unicode::String::latin1( $subj );
>> ta,
>> N
>> _______________________________________________
>> Melbourne-pm mailing list
>> Melbourne-pm at pm.org
>> http://mail.pm.org/mailman/listinfo/melbourne-pm
>
> --
> _ _ _
> Stephen Edmonds _/ \_ / \_/ \
> Melbourne, Australia <_ " _> / \
> / O \ / " \
> stephen at popcorn.cx / ___ \ | O |
> http://popcorn.cx/ \_____/ \___/
> _______________________________________________
> Melbourne-pm mailing list
> Melbourne-pm at pm.org
> http://mail.pm.org/mailman/listinfo/melbourne-pm
More information about the Melbourne-pm
mailing list