Subject: | "Invalid expression" error when using utf-16 |
Using the findnodes method on a XML document originally encoded as
utf-16 leads to an "Invalid expression" error. See the attached sample
script and XML files. There's no problem if the XML file was converted
into utf-8, or even using setEncoding("utf-8") seems to fix the problem.
This was observed on a Debian Linux system with perl 5.8.8 and
libxml2.so.2.6.32.
Regards,
Slaven
Subject: | bla6.pl |
#!/usr/bin/perl
use XML::LibXML;
my $p = XML::LibXML->new;
my $doc = $p->parse_file("utf-16-2.cml");
#$doc->setEncoding('utf-8'); # "fixes" the problem
my @nodes = $doc->findnodes("/cml/*");
Subject: | utf-16-2.cml |