[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [TV] XML Parsing

In list.comp.tv, worm wrote:
> I'm using Perl (because it is available on the system) and XML::Simple
> seems to do pretty much what I want, but it's failing on a few of the
> 'special' characters, like pound signs and accented characters etc.

The XML files are now encoded using HTML::Entities which means the
special characters are converted into character entities of the form
£ (for, say, a pound sign). This is necessary to get the XML to be
> Am I just being stupid, or do I have to filter the files first to get them
> to work ok?

Assuming you've got a string containing, say, the programme title then
the following is the kind of code you should be looking at:

    #!/usr/bin/perl -w
    use strict;
    use HTML::Entities;

    my $title = 'Big £££ Giveaway';
    print decode_entities($title);

Of course, if it's not a case that the special characters are coming out
as '&....;' then that probably won't help and we'll need more details



Andrew Flegg -- mailto:andrew@xxxxxxxx  |  http://www.bleb.org/