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

Alceu Rodrigues de Freitas Junior
---------------------------------
"You have enemies? Good. That means you've stood up for something, sometime in your life." - Sir Winston Churchill

In reply to perlpacktut "packing text" example and Unicode by glasswalk3r

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.