Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: Encoding horridnessby Corion (Patriarch) |
on Jul 12, 2017 at 13:10 UTC ( [id://1194922]=note: print w/replies, xml ) | Need Help?? |
You will also have to make sure that the data you are writing to the XML file has been read properly from your data source and has been properly decoded when reading it. Ideally you use Encode and decode all data when you read it into your program and encode it when writing it to your output. You have already taken care of encodeing the output, but the input might not be valid UTF-8 or not be recognized by Perl as such. Assuming that your input data is a file with bytes encoded in Latin-1, you could read/decode the data as
For database values, you have the additional fun of finding out as what kind of data/encoding your database actually stores the values.
In Section
Seekers of Perl Wisdom
|
|