gothic_mallard has asked for the wisdom of the Perl Monks concerning the following question:
Hi all
I'm having problems using XML::Simple to parse a data file containing the '£' symbol.
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 :)
Update
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.
All opinions expressed are my own and are intended as guidance, not gospel; please treat what I say as such and as Abigail said Think for yourself.
If in doubt ask.
s++blah+;y(bl) .j.s;s+(h)+p$1+;???print:??;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problem reading £ sign with XML::Simple
by mirod (Canon) on Apr 27, 2005 at 09:20 UTC | |
by gothic_mallard (Pilgrim) on Apr 27, 2005 at 09:45 UTC | |
by mirod (Canon) on Apr 27, 2005 at 10:40 UTC | |
by dave_the_m (Monsignor) on Apr 27, 2005 at 10:20 UTC | |
by demerphq (Chancellor) on Apr 27, 2005 at 15:51 UTC | |
by alexz (Beadle) on Apr 27, 2005 at 18:19 UTC | |
|
Re: Problem reading £ sign with XML::Simple
by wazoox (Prior) on Apr 27, 2005 at 10:34 UTC | |
|
Re: Problem reading £ sign with XML::Simple
by pelagic (Priest) on Apr 27, 2005 at 09:46 UTC | |
by gothic_mallard (Pilgrim) on Apr 27, 2005 at 10:01 UTC |