|XP is just a number|
Problem reading £ sign with XML::Simpleby gothic_mallard (Pilgrim)
|on Apr 27, 2005 at 08:42 UTC||Need Help??|
gothic_mallard has asked for the
wisdom of the Perl Monks concerning the following question:
The data appears to read in correctly without error, but when I come to output it, the symbol appears as 'Â£'.
Trawling as much documentation as I could find, SuperSearching and googling it looks like this is a problem with the encoding - the XML::Parser transforms everything to UTF-8 internally which can't handle '£' correctly. If I understand correctly it performs a bit shift that changes it into the 2-byte char that gets output.
The problem I have is how to get the correct symbol back when I read the data back out.
I've tried playing with the various encoding options of XML::Simple (and I've tried XML::DOM also) but to no avail. Maybe I'm missing something obvious by staring at it too hard.
Any help would be greatly appreciated :)
Thanks for all the helpful advice everyone! I think I have a few possible solutions now to the problem (which I'll have to find which will work best under the system / network architecture that we have here) which is a lot more than the "none" that I had when I started :)
You've saved me a lot of torn out hair :)
All code is untested unless otherwise stated.