User: gaute Date: 2007/04/25 06:18:57 Modified: no/www/rss.pl
Log: Encode entities outside of XML::RSS, so that new and older XML::RSS generates identical content File Changes: Directory: /no/www/ =================== File [changed]: rss.pl Url: http://no.openoffice.org/source/browse/no/www/rss.pl?r1=1.7&r2=1.8 Delta lines: +6 -4 ------------------- --- rss.pl 25 Apr 2007 09:01:13 -0000 1.7 +++ rss.pl 25 Apr 2007 13:18:54 -0000 1.8 @@ -1,6 +1,6 @@ #!/usr/bin/perl -# $Id: rss.pl,v 1.7 2007/04/25 09:01:13 gaute Exp $ +# $Id: rss.pl,v 1.8 2007/04/25 13:18:54 gaute Exp $ # # Generates an RSS feed from the news on our front page. # @@ -46,8 +46,9 @@ use Encode qw(decode); use POSIX qw(mktime strftime setlocale); use XML::RSS; +use HTML::Entities qw(encode_entities_numeric); -my $CHANNEL_TITLE = "OpenOffice.org pÃ¥ norsk"; +my $CHANNEL_TITLE = "OpenOffice.org på norsk"; my $CHANNEL_LINK = "http://no.openoffice.org/"; my $CHANNEL_DESC = "Nytt om OpenOffice.org"; my $CHANNEL_LANG = "no"; @@ -60,7 +61,8 @@ undef $/; my $html = <>; -my $rss = XML::RSS->new(version => '2.0'); +my $rss = XML::RSS->new(version => '2.0', + encode_output => 0); $rss->channel(title => $CHANNEL_TITLE, link => $CHANNEL_LINK, description => $CHANNEL_DESC, @@ -81,11 +83,11 @@ </p> (.*?) # $5: description </div>}gxs) { - my $title = decode("utf8", $1); + my $title = encode_entities_numeric(decode("utf8", $1)); my $day = $2; my $month = $3 - 1; my $year = $4 - 1900; - my $description = decode("utf8", $5); + my $description = encode_entities_numeric(decode("utf8", $5)); # Craft a guid from title and date. my $guid = "$title $year-$month-$day"; --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
