Home: Perl Programming Help: Beginner:
Understanding UTF-8 Output with XMLin and Map

New User

Feb 24, 2014, 6:27 AM

Views: 2566
Understanding UTF-8 Output with XMLin and Map

I've been set an assignment to get a xml file from a web api, and then work out how many times an author occurs and print out my tabulated results.

I did this by using XMLin (from XML::Simple) and LWP::Simple Get function.
Then when I dump out the data with Data::Dumper, the characters are encoded in their original \x37 etc..

I've got to create a report on how I output the data, and one key point is how I dealt with the UTF-8 to make it output correctly.

To print out my results I used a Hash function with a linear sort to arrange in descending order. Then printed them into tables with help of the print table() command.

Extra: using cgi.

The confusing part: It didn't work, then I tried adding Stdout and use utf8, which didn't work either, then I deleted those and it started working Crazy

This prints out the UTF-8 correctly now,
So my question is; how does it output the utf 8 correctly into the table?
& why does this work suddenly? Unimpressed

Thanks in advance