Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: UTF-8 problem parsing XML

by Joost (Canon)
on Apr 14, 2007 at 15:54 UTC ( #610075=note: print w/replies, xml ) Need Help??

in reply to UTF-8 problem parsing XML

Assuming the input file is really latin-1, you can do a couple of things:

  • Add an XML declaration with an encoding attribute to the XML file - <?xml encoding="iso-8859-1"?> - that should make sure the XML parser will do the right thing.
  • Convert the XML to utf8, which you've tried but you got it backwards. The correct statement is $xml = decode('iso-8859-1', $xml);
  • Figure out some other way to signal the real encoding to XML::Simple. Not sure if you can.

Replies are listed 'Best First'.
Re^2: UTF-8 problem parsing XML
by rinceWind (Monsignor) on Apr 15, 2007 at 00:01 UTC

    Thanks! Changing encode to decode did the trick.

    Apprentice wetware hacker

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://610075]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2022-05-16 12:00 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (63 votes). Check out past polls.