glasswalk3r has asked for the wisdom of the Perl Monks concerning the following question:
Greetings monks,
I was trying to apply the concepts of Packing Text in the output of a program and it's working fine to split an entire line into a nice array... until I got some unicode characters in the line.
The entire line is being from a UTF-8 file that was correctly read by using open(my $in, '<:utf8', $file), I can check by looking the debugger that the Unicode strings were correctly interpreted (like execu\x{e7}\x{e3}o) but after using the unpack function I just get garbage.
The template I'm using is A12A19A41A10A14A13A19A13A13A13A13A21A13A11A14A14 and since I have exactly 2 spaces separating the fields, the result is what I need, except for the unicode characters "corrupted".
Is there any way to apply the same concept to UTF-8 characters? I have tried using the "U" mask, but without any results.
I'm using Windows XP Service Pack 3 with Active Perl 5.8.9. And yes, I'm using chcp 65000 to get UTF-8 characters in the terminal.
Thanks to all
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: perlpacktut "packing text" example and Unicode
by ikegami (Patriarch) on Jul 13, 2011 at 09:02 UTC | |
|
Re: perlpacktut "packing text" example and Unicode
by 7stud (Deacon) on Jul 13, 2011 at 05:25 UTC | |
by glasswalk3r (Friar) on Jul 14, 2011 at 17:03 UTC |