r16488 - in /trunk/libxml-dom-perl/debian: changelog patches/encoding_test.patch patches/output_encoding.patch patches/series
tincho-guest at users.alioth.debian.org
tincho-guest at users.alioth.debian.org
Tue Mar 4 16:21:38 UTC 2008
Author: tincho-guest
Date: Tue Mar 4 16:21:37 2008
New Revision: 16488
URL: http://svn.debian.org/wsvn/?sc=1&rev=16488
Log:
* Modified gregor's patch to not touch strings except when printingToFile,
as internally the strings should not be recoded. Also added
encoding_test.patch, which is a testcase for encoding issues, both in
parsing, and printing to a file.
Added:
trunk/libxml-dom-perl/debian/patches/encoding_test.patch
Modified:
trunk/libxml-dom-perl/debian/changelog
trunk/libxml-dom-perl/debian/patches/output_encoding.patch
trunk/libxml-dom-perl/debian/patches/series
Modified: trunk/libxml-dom-perl/debian/changelog
URL: http://svn.debian.org/wsvn/trunk/libxml-dom-perl/debian/changelog?rev=16488&op=diff
==============================================================================
--- trunk/libxml-dom-perl/debian/changelog (original)
+++ trunk/libxml-dom-perl/debian/changelog Tue Mar 4 16:21:37 2008
@@ -1,11 +1,18 @@
libxml-dom-perl (1.44-2) UNRELEASED; urgency=low
+ [ gregor herrmann ]
TODO: could someone with more knowledge of encodings and XML please check
the new patch?
* Drop patch 01-fix_utf8_tests.patch (not needed anymore); add patch
output_encoding.patch; encode output for printToFile() and toString() in
encoding from xml declaration (closes: #324882).
+
+ [ MartÃn Ferrari ]
+ * Modified gregor's patch to not touch strings except when printingToFile,
+ as internally the strings should not be recoded. Also added
+ encoding_test.patch, which is a testcase for encoding issues, both in
+ parsing, and printing to a file.
-- gregor herrmann <gregor+debian at comodo.priv.at> Fri, 22 Feb 2008 18:06:08 +0100
Added: trunk/libxml-dom-perl/debian/patches/encoding_test.patch
URL: http://svn.debian.org/wsvn/trunk/libxml-dom-perl/debian/patches/encoding_test.patch?rev=16488&op=file
==============================================================================
--- trunk/libxml-dom-perl/debian/patches/encoding_test.patch (added)
+++ trunk/libxml-dom-perl/debian/patches/encoding_test.patch Tue Mar 4 16:21:37 2008
@@ -1,0 +1,55 @@
+Index: libxml-dom-perl/t/encodings.t
+===================================================================
+--- /dev/null
++++ libxml-dom-perl/t/encodings.t
+@@ -0,0 +1,50 @@
++#!/usr/bin/perl
++use strict;
++use utf8; # for embedded strings
++#use Encode;
++use XML::DOM;
++use Test;
++use constant TMPFILE => "test_encoding.xml";
++
++BEGIN { plan tests => 15 }
++
++my $str =
++q(<?xml version="1.0" encoding="UTF-8"?>
++<blah>
++ <foo baz="î¶î·">ã</foo>
++ <bar>ï¾ï¿îµî¶î·î¸î¹îºî»î¼î½î¾</bar>
++</blah>);
++
++# test 1 -- check for correct parsing of input string
++my $parser = new XML::DOM::Parser;
++my $doc = eval { $parser->parse($str); };
++ok((not $@) && defined $doc);
++
++try($doc);
++$doc->printToFile(TMPFILE);
++$doc->dispose;
++
++ok(system("xmllint", "--noout", TMPFILE) == 0);
++
++my $doc2 = eval { $parser->parsefile(TMPFILE) };
++ok((not $@) && defined $doc2);
++
++try($doc2);
++$doc2->dispose;
++unlink TMPFILE;
++
++sub try {
++ my $doc = shift;
++ my $foo = ${$doc->getDocumentElement->getElementsByTagName("foo")}[0];
++ my $bar = ${$doc->getDocumentElement->getElementsByTagName("bar")}[0];
++ my $baz = $foo->getAttribute("baz");
++ my $footext = $foo->getFirstChild->getData;
++ my $bartext = $bar->getFirstChild->getData;
++
++ ok(utf8::is_utf8($baz));
++ ok($baz, "\x{E4B6}\x{E4B7}");
++ ok(utf8::is_utf8($footext));
++ ok($footext, "\xE3\x{F8E8}");
++ ok(utf8::is_utf8($bartext));
++ ok($bartext, "\x{FB7E}\x{FB7F}\x{E4B5}\x{E4B6}\x{E4B7}\x{E4B8}\x{E4B9}\x{E4BA}\x{E4BB}\x{E4BC}\x{E4BD}\x{E4BE}");
++}
Modified: trunk/libxml-dom-perl/debian/patches/output_encoding.patch
URL: http://svn.debian.org/wsvn/trunk/libxml-dom-perl/debian/patches/output_encoding.patch?rev=16488&op=diff
==============================================================================
--- trunk/libxml-dom-perl/debian/patches/output_encoding.patch (original)
+++ trunk/libxml-dom-perl/debian/patches/output_encoding.patch Tue Mar 4 16:21:37 2008
@@ -1,37 +1,5 @@
--- libxml-dom-perl.orig/lib/XML/DOM.pm
+++ libxml-dom-perl/lib/XML/DOM.pm
-@@ -35,6 +35,7 @@
- );
- use Carp;
- use XML::RegExp;
-+use Encode;
-
- BEGIN
- {
-@@ -485,8 +486,8 @@
-
- sub toString
- {
-- my $self = shift;
-- $$self;
-+ my ($self, $encoding) = @_;
-+ Encode::encode($encoding, $$self);
- }
-
- sub reset
-@@ -1193,10 +1194,11 @@
- sub toString
- {
- my $self = shift;
-+ my $encoding = $self->getXMLDecl()->getEncoding();
- my $pr = $XML::DOM::PrintToString::Singleton;
- $pr->reset;
- $self->print ($pr);
-- $pr->toString;
-+ $pr->toString($encoding);
- }
-
- sub to_sax
@@ -1218,7 +1220,8 @@
sub printToFile
{
Modified: trunk/libxml-dom-perl/debian/patches/series
URL: http://svn.debian.org/wsvn/trunk/libxml-dom-perl/debian/patches/series?rev=16488&op=diff
==============================================================================
--- trunk/libxml-dom-perl/debian/patches/series (original)
+++ trunk/libxml-dom-perl/debian/patches/series Tue Mar 4 16:21:37 2008
@@ -1,1 +1,2 @@
+encoding_test.patch
output_encoding.patch
More information about the Pkg-perl-cvs-commits
mailing list