Bug#324882: libxml-dom-perl: ignores encoding on output

Glenn Maynard g_deb at zewt.org
Mon Mar 3 01:50:42 UTC 2008


On Fri, Feb 22, 2008 at 05:55:12PM +0100, gregor herrmann wrote:
> I've created a tentative patch now which seems to fix the encoding
> both for the printToFile() and the toString() funtcions.
> 
> I'm attaching the patch and my testcase, and I'd like to ask for
> comments.

I'd recommend testing with an encoding other than latin1; its codepoints
overlap with UTF-8's, so it doesn't test conversion very well.

getAttribute() is still  entities incorrectly, which is where I had
problems.  In UTF-8, even with use utf8, this prints the raw byte 0xE4:

#!/usr/bin/perl;
use strict;
use warnings;
use utf8;
use XML::DOM;

my $parser = new XML::DOM::Parser;
my $doc = $parser->parse('<?xml version="1.0" encoding="UTF-8"?><blah x="test: &#228;"/>');
print $doc->getDocumentElement->getAttribute("x");

-- 
Glenn Maynard





More information about the pkg-perl-maintainers mailing list