Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: XML::Parser Encoding (UTF-8 -> ISO-8859-1)by bart (Canon) |
on Sep 12, 2002 at 20:15 UTC ( [id://197337]=note: print w/replies, xml ) | Need Help?? |
Annoying, isn't it? Perl has its own idea of whether your data should be treated as UTF8 or as 8-bit encoding, and it may not agree with your idea. If you concat a plain 8-bit string with a string marked as UTF-8, Perl will convert the 8-bit string to UTF-8 as well, whether you want it or not.
The trickery is all connected to the UTF8 flag, which is a bit flag attached to each string. For the data that XML::Parser returns, that UTF8 flag is set. To get rid of this behaviour, clear the UTF8 flag. One way you can do it, is like this: This way, the resulting string will be the same byte data as the original string, but with the UTF8 flag cleared. So now, the string should stay in ISO-Latin-1.
In Section
Seekers of Perl Wisdom
|
|