[BNM] Perl virgin seeks advice!

AndrewGill73@gmail.com andrewgill73 at gmail.com
Thu Aug 7 16:23:25 BST 2008


Cheers - ok, the script uses a library called "XML::Parser" and fails at the
first line below:

eval {$p->parsefile("filename.xml");};
    if($@){  #if error with parsing file
      print "Error Processing XML File - $@\n";

#rename("/home/inboxchroot/home/ibx04/$xmlreplace","/home/inboxchroot/home/ibx04/$xmlerror");
    }

I know the Perl script has run before with exactly the same XML file! So I'm
guessing (and hoping) there is switch I can use when running the script. I
could be completely wrong of course!

Many thanks
cheers,
Andy

On Thu, Aug 7, 2008 at 4:07 PM, Karl Dane <karl at rince.net> wrote:

> Hard to know without seeing the script, but it may be that you need to
> properly decode the utf8-encoded characters to perl internal strings.
>
> Have a look at 'Encode' -
> http://search.cpan.org/~dankogai/Encode-2.26/Encode.pm<http://search.cpan.org/%7Edankogai/Encode-2.26/Encode.pm>
>
> Karl
>
>
> 2008/8/7 AndrewGill73 at gmail.com <andrewgill73 at gmail.com>:
> > Hi David,
> > The first line is: <?xml version="1.0" encoding="UTF-8" ?>
> >
> > cheers,
> > Andy
> >
> > On Thu, Aug 7, 2008 at 3:49 PM, David Pashley <david at davidpashley.com
> >wrote:
> >
> >> On Aug 07, 2008 at 15:25, AndrewGill73 at gmail.com praised the llamas by
> >> saying:
> >> > Hi guys,
> >> >
> >> > I'm a Perl virgin. I'm working for a customer who's asked me to make
> some
> >> > changes to a Perl script.
> >> >
> >> > The perl script parses a large xml file that contains non-english
> >> > characters. When I run the script it fails whenever it tries to parse
> the
> >> > non-english characters.
> >> >
> >> > I'm executing the perl script as 'perl -w [script name].pl'. However,
> >> I've
> >> > tried using the -C switches to turn unicode on but this hasn't given
> me
> >> any
> >> > joy !
> >> >
> >> What's the first line of the XML document?
> >>
> >> --
> >> David Pashley
> >> david at davidpashley.com
> >> Nihil curo de ista tua stulta superstitione.
> >> --
> >>
> >> BNM Subscribe/Unsubscribe:
> >> http://www.brightonnewmedia.org/options/bnmlist
> >>
> >>
> >> dConstruct tickets on sale from 11am, 24 June -
> >> http://2008.dconstruct.org/
> >>
> >> BNM powered by Wessex Networks:
> >> http://www.wessexnetworks.com
> >>
> >
> >
> >
> > --
> > Kind regards,
> >
> > Andrew Gill
> > Binary Portfolio Ltd
> > +44(0)1273-782909
> >
> > This message and any attachments (the "message") are confidential,
> intended
> > solely for the addressee(s), and may contain legally privileged
> information.
> > Any unauthorised use or dissemination is prohibited. E-mails are
> susceptible
> > to alteration.
> > Neither Andrew Gill or Binary Portfolio Ltd nor any of its subsidiaries
> or
> > affiliates shall be liable for the message if altered, changed or
> > falsified.
> > --
> >
> > BNM Subscribe/Unsubscribe:
> > http://www.brightonnewmedia.org/options/bnmlist
> >
> >
> > dConstruct tickets on sale from 11am, 24 June -
> http://2008.dconstruct.org/
> >
> > BNM powered by Wessex Networks:
> > http://www.wessexnetworks.com
> >
> --
>
> BNM Subscribe/Unsubscribe:
> http://www.brightonnewmedia.org/options/bnmlist
>
>
> dConstruct tickets on sale from 11am, 24 June -
> http://2008.dconstruct.org/
>
> BNM powered by Wessex Networks:
> http://www.wessexnetworks.com
>



-- 
Kind regards,

Andrew Gill
Binary Portfolio Ltd
+44(0)1273-782909

This message and any attachments (the "message") are confidential, intended
solely for the addressee(s), and may contain legally privileged information.
Any unauthorised use or dissemination is prohibited. E-mails are susceptible
to alteration.
Neither Andrew Gill or Binary Portfolio Ltd nor any of its subsidiaries or
affiliates shall be liable for the message if altered, changed or
falsified.


More information about the BNMlist mailing list. Powered by Wessex Networks