good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
XML converts to UTF-8 and causes problems for non-English language speakersby htoug (Deacon) |
on Jun 19, 2002 at 10:45 UTC ( [id://175617]=perlquestion: print w/replies, xml ) | Need Help?? |
htoug has asked for the wisdom of the Perl Monks concerning the following question:
My problem is whenever I use XML in Perl everything gets converted to UTF-8, which is OK, as that is documented everywhere. The docs also advise that you use utf to minimize any problems with UTF-8 and Perl. The authors must have been english-speaking! My language (danish) uses three not-uncommon (in danish that is) letters: æ, ø and å, that in the characterset we normally use (ISO-8859-1) are 8 bits long. In UTF-8 they are 16-bit characters. Any attempt to use them, in eg. a comment, results in syntax errors from perl. Whats more any data that we read from a file, or want to output to a file should be in ISO-8859-1 or it will be gibberish. The way out has been to avoid use utf; and instead convert from UTF-8 to ISO-8859-1 everywhere data is fetched from XML, preferably by subclassing the XML-modules. This is clunky, and errorprone. Presently I sit and wait for Perl6 with line disciplines, and a new version of the operation system, that allows us to switch to UTF-8 (just leaving us with the minor task of converting all our data and files ;-) Is there a monk out there who has another (preferably better - but I'm not picky) way of doing it?
Back to
Seekers of Perl Wisdom
|
|