in reply to Encoding horridness
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
while( <$fh>) { my $payload = decode('Latin-1', $_); };
For database values, you have the additional fun of finding out as what kind of data/encoding your database actually stores the values.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Encoding horridness
by Anonymous Monk on Jul 12, 2017 at 14:07 UTC | |
by Corion (Patriarch) on Jul 12, 2017 at 14:20 UTC | |
by Anonymous Monk on Jul 12, 2017 at 14:26 UTC | |
by choroba (Cardinal) on Jul 12, 2017 at 16:51 UTC | |
by Anonymous Monk on Jul 12, 2017 at 17:55 UTC | |
by hippo (Archbishop) on Jul 12, 2017 at 14:16 UTC | |
by Anonymous Monk on Jul 12, 2017 at 14:20 UTC |