appendTextChild is sensitive to the internal format Perl is using to
store the string containg its second argument.
Show quoted text
---------- BEGIN CODE ----------
use strict;
use warnings;
use XML::LibXML qw( );
my $s = "abcd\x{f6}efgh";
if ($ARGV[0]) {
# One internal format
utf8::downgrade($s);
} else {
# Other internal format
utf8::upgrade($s);
}
XML::LibXML::Element->new('foo')->appendTextChild('Node', $s);
---------- END CODE ----------
---------- BEGIN OUTPUT ----------
>perl test.pl 0
>perl test.pl 1
error : xmlEncodeEntitiesReentrant : char out of range
---------- END OUTPUT ----------
Interestingly, the resulting XML is identical.