Nikolaus Rath via RT wrote:
Show quoted text> I tried to reinstall, but:
>
> Failed Test Stat Wstat Total Fail Failed List of Failed
> --------------------------------------------------------------------------------------------------------
> t/test_additional.t 647 2 0.31% 346 348
> t/test_bugs_3.18.t 157 13 8.28% 11-23
> t/test_bugs_3.19.t 26 6 23.08% 5-6 20-23
> Failed 3/82 test scripts, 96.34% okay. 21/3795 subtests failed, 99.45% okay.
> make: *** [test_dynamic] Error 255
>
>
> Before that, I got a lot of UTF-8 encoding warnings, which allowed me
> to narrow the problem: Both 'make test' and my testcase work if I
> unset PERL_UNICODE (which is set to SDAL here, because it's a pure
> UTF-8 system).
>
> I hope this helps to pin down the problem.
It does, nice job,
With PERL_UNICODE set to SDAL, I was able to reproduce the bug, and
indeed to get the same error message you got.
It goes away if, instead of parsing a pipe from bzcat, I parse a regular
XML file. It also works fine if you do the bzcat and pipe it to the
code: PERL_UNICODE=SDAL bzcat -c rt_17500.xml.bz2 | perl bug.pl
and parse \*STDIN in the code.
Stepping through the code with debugger it looks like actually the
problem occurs before even reaching any XML::Twig specific code. It
looks like it's a problem with IO::File ignoring PERL_UNICODE (or -C).
XML::Parser, on which XML::Twig is based, uses IO::File.
This is confirmed by this thread:
http://www.mhonarc.org/archive/html/perl-unicode/2004-04/msg00004.html
As the problem is due to the 'D' option, telling perl to use the perlIO
layer, the easiest workaround is to use the -CSAL option on the shebang
line (or on the command line).
As for the test failures: you end telling the system to read as unicode,
files that are in iso-8859-1. I will have to take this case into account
in the test (baring in mind that XML::Twig should still work with very
old versions of perl!).
So I will fix the tests and add a note about the PERL_UNICODE/-CD option
in the docs (and in the FAQ).
Does this solve the problem?
Thanks
--
Michel Rodriguez
Perl & XML
xmltwig.com