|P is for Practical|
XML::Parser Encoding (UTF-8 -> ISO-8859-1)by Emanuel (Pilgrim)
|on Sep 11, 2002 at 23:23 UTC||Need Help??|
Emanuel has asked for the wisdom of the Perl Monks concerning the following question:
Hello wise monks
I'm running into a problem, and I can't seem to find any solution to it for the past 2 days. Here's what it's all about:
o I got an UTF-8 encoded XML file
o I parse it in and want to write some parts of it to a mysql database, ISO-8859-1 encoded
Everything is working fine, i'm reading the XML in, creating a hash out if it with XML::Parser, data gets written to MySQL aswell, but when I check the data in the table, it's UTF-8 again.
So I started playing with Text::Iconv, and came to this:
When I print the values out (eg: print $converter->convert($value)."\n"; ) it looks correct (eg ISO-8859-1 encoded), but when writing to the DB, it's UTF-8 again (meaning all special chars, like öäüéàè etc are some weird chars like Ã| etc...).
I'm really going nuts here, and would appreciate any help provided for this.
If more of the source is needed just tell me.
Thanks in Advance