Hi,

I have written a small perl script that reads a few RSS flows and
generate an HTML file. It seems one of them have non-ASCII character not
encoded ; this make the script stop.

*** perl script says 
***
not well-formed (invalid token) at line 90, column 63, byte 3936 at
/usr/pkg/lib/perl5/vendor_perl/5.8.0/sparc64-netbsd-thread-multi/XML/Parser.pm
line 187

if I manually fetch the RSS file and read it, the problem ("at line 90,
column 63") is the "ö" from "... Rainer Brinkmöller, I...".

I don't find which part of my script to modify :(

Any idea ?
TIA,
        Jo

PS: my script is :
########################################################################
#!/usr/bin/env perl
#
# Get RSS News and generate HTML files for inclusion
#

use strict;
use XML::RSS;
use LWP::Simple;
use File::Basename;
use URI::Escape;

# List of RSS/News
#
#       "10-hubertf" => "http://www.feyrer.de/NetBSD/blog-rss.xml";,
my %news = (
        "05-netbsd" => "http://www.netbsd.org/Changes/rss-netbsd.xml";,
        "06-ndigest" => "http://digest.coris.org.uk/feeds/cvs-rss.xml";,
        "10-hubertf" => "http://www.feyrer.de/NetBSD/blog-rss.xml";,
        "15-undeadly" => "http://undeadly.org/cgi?action=rss";,
        "20-afp" => "http://www.afp.com/francais/rss/stories.xml";
);

# For all of the RSS sources listed above
#
foreach my $k (keys(%news)) {
        my $rss = new XML::RSS();
        my $raw = get($news{$k});
        $rss->parse($raw);

        my $nonews = @{$rss->{'items'}};
        if($nonews > 5) { $nonews = 5 };        # Only show the 5 more
recent news ;)

        open(FILEWRITE, "> " . dirname($0) . "/" . $k . ".html");
        print FILEWRITE "<h1>" . $rss->channel('title') . " <a href=\""
. $rss->channel('link') . "\">[+]</a></h1>\n";
        print FILEWRITE "<ul>\n";
        for (my $i=0; $i<$nonews; $i++) {
                my $item = @{$rss->{'items'}}[$i];
                my $title = $item->{'title'};
                my $url = $item->{'link'};
                $url =~ s/\&sid/\&amp;sid/;
                print FILEWRITE "<li><a href=\"" . $url . "\">" . $title
. "</a></li>\n";
        }
        print FILEWRITE "</ul>\n";
        close FILEWRITE;
}
########################################################################

-- 
,- This mail runs ------.
`--------- NetBSD/smtp -'

Attachment: pgpjZIx6ypdws.pgp
Description: PGP signature

Reply via email to