in reply to Re: UTF8 issue with XML::XPath
in thread UTF8 issue with XML::XPath

no-no, you didn't understand me... the problem is not in text files.
I can read/write files in UTF8 without any problems (since I'm on linux and UTF8 is my default locale) even without specifying bindmode. my console is in UTF8. And if I run
print $xp->find('/conf')->get_node(1)->toString();
it will give me data in wrong encoding. So it's not related with files I/O... it's in XML::XPath

Replies are listed 'Best First'.
Re^3: UTF8 issue with XML::XPath
by moritz (Cardinal) on Mar 05, 2008 at 12:00 UTC
    Even if your default locale is utf8, you need to specify input and output conversions. The locale doesn't effect I/O layer by default (it can be enabled with user open ':locale';, though).

    XML::XPath will most likely return text strings, while print can only work properly with byte strings.

    So you might even want to try binmode STDOUT, ':encoding(UTF-8)'; before printing.

      no, that doesn't help. I told you - it's XML::XPath issue, not my console/IO/locale... hm... looks like I'm going to switch to some other library, like XML::LibXML