Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: UTF-8 problem parsing XML

by Joost (Canon)
on Apr 14, 2007 at 15:54 UTC ( [id://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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (7)
As of 2024-04-24 20:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found