Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

TorgoX (1933)

TorgoX
  sburkeNO@SPAMcpan.org
http://search.cpan.org/~sburke/

"Il est beau comme la retractilité des serres des oiseaux rapaces [...] et surtout, comme la rencontre fortuite sur une table de dissection d'une machine à coudre et d'un parapluie !" -- Lautréamont

Journal of TorgoX (1933)

Monday June 16, 2003
04:53 AM

improved RSS for nntp.perl.org

[ #12873 ]
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);
  };
}

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.