Hi,
I have been working for a while already on this problem. I read many of the already valuable available documentation from perlmonks experts, but this UTF8 support doesn't seem to be working correclty in Perl :(
I'm reading a XML utf8 russian file and at the moment I'm trying to extract the element content and pass it to another XML structure, Perl is not reading UTF8 charcaters but trying to read per byte as a charcater:
$SourceHash->{$order_value} = $import_StringTable_xp_node->findvalue( +"value[\@language!=\"English\"]/text"); print XML_DIFF_FH $SourceHash->{$order_value} . "\n"; $SourceHash->{$order_value} = pack ("U*", unpack("C*", $SourceHash->{$ +order_value})); print XML_DIFF_FH $SourceHash->{$order_value} . "\n"; print STDERR Encode::is_utf8($SourceHash->{$order_value})?"1":"0";
[download]
Even when the Filehandle is opened in utf8 mode this is not working. I can see the UTF8 flag is active with the pack conversion (this was the only mechanism that allow me to activate the flag, the other approaches doesn't seem to work i.e. decode utf8). I already tried : use bytes, use utf8 but nothing works. Any help will be highly appreciated ! Cheers PerlMonks ! Inguanzo

In reply to Using a variable with UTF8 content coming from XPATH findvalue by inguanzo

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.