Dear All,
In a fit of activity, I whipped up some code so that the RSS feeds at nntp.perl.org will do MIME-decoding, so that in the perl.copenhagen archives for example, you get "Næste møde" (Næste møde) instead of "=?iso-8859-1?Q?N=E6ste_m=F8de?=" in the XML. Me and Robert will get this working for the HTML views soon too.
For future reference, the magic I used was doing
use Encode qw/decode/; use utf8;
and then with a value in $_, ...
if( m/=?/ ) { s/\?unknown-8bit\?/?iso-8859-1?/gs; # our best bet eval { # trap exceptions from unknown encodings my $x = decode( 'MIME-Header', $_); $_ = $x if utf8::valid($x); }; }
m/=?/
should be m/=\?/
, presumably. The first matches anything.
Re:Typo
TorgoX on 2003-06-17T16:08:22
Oops! You're right! I was so intent on whether I should add more context to the pattern, that I missed the fact I should escape the "?" ! Thanks for catching that!