r9846 - in /trunk/libxml-sax-perl: SAX/PurePerl.pm SAX/PurePerl/Productions.pm SAX/PurePerl/Reader.pm SAX/PurePerl/Reader/UnicodeExt.pm debian/changelog debian/patches/charset-decoding debian/patches/series t/14encoding.t
ntyni-guest at users.alioth.debian.org
ntyni-guest at users.alioth.debian.org
Tue Nov 27 19:00:01 UTC 2007
Author: ntyni-guest
Date: Tue Nov 27 19:00:01 2007
New Revision: 9846
URL: http://svn.debian.org/wsvn/?sc=1&rev=9846
Log:
+ charset-decoding: Fix charset decoding in the PurePerl module (#405186)
Added:
trunk/libxml-sax-perl/debian/patches/charset-decoding
Modified:
trunk/libxml-sax-perl/SAX/PurePerl.pm
trunk/libxml-sax-perl/SAX/PurePerl/Productions.pm
trunk/libxml-sax-perl/SAX/PurePerl/Reader.pm
trunk/libxml-sax-perl/SAX/PurePerl/Reader/UnicodeExt.pm
trunk/libxml-sax-perl/debian/changelog
trunk/libxml-sax-perl/debian/patches/series
trunk/libxml-sax-perl/t/14encoding.t
Modified: trunk/libxml-sax-perl/SAX/PurePerl.pm
URL: http://svn.debian.org/wsvn/trunk/libxml-sax-perl/SAX/PurePerl.pm?rev=9846&op=diff
==============================================================================
--- trunk/libxml-sax-perl/SAX/PurePerl.pm (original)
+++ trunk/libxml-sax-perl/SAX/PurePerl.pm Tue Nov 27 19:00:01 2007
@@ -672,7 +672,7 @@
return unless length($name);
- $name =~ /^$NameChar+$/o or $self->parser_error("Name <$name> does not match NameChar production", $reader);
+ $name =~ /$NameChar/o or $self->parser_error("Name <$name> does not match NameChar production", $reader);
return $name;
}
Modified: trunk/libxml-sax-perl/SAX/PurePerl/Productions.pm
URL: http://svn.debian.org/wsvn/trunk/libxml-sax-perl/SAX/PurePerl/Productions.pm?rev=9846&op=diff
==============================================================================
--- trunk/libxml-sax-perl/SAX/PurePerl/Productions.pm (original)
+++ trunk/libxml-sax-perl/SAX/PurePerl/Productions.pm Tue Nov 27 19:00:01 2007
@@ -4,7 +4,7 @@
use Exporter;
@ISA = ('Exporter');
- at EXPORT_OK = qw($S $Char $VersionNum $BaseChar $Ideographic
+ at EXPORT_OK = qw($S $Char $VersionNum $BaseChar $Letter $Ideographic
$Extender $Digit $CombiningChar $EncNameStart $EncNameEnd $NameChar $CharMinusDash
$PubidChar $Any $SingleChar);
@@ -36,10 +36,12 @@
$Digit = qr/ [\x30-\x39] /x;
+ $Letter = qr/^ $BaseChar $/x;
+
# can't do this one without unicode
# $CombiningChar = qr/^$/msx;
- $NameChar = qr/ $BaseChar | $Digit | [._:-] | $Extender /x;
+ $NameChar = qr/^ $BaseChar | $Digit | [._:-] | $Extender $/x;
PERL
die $@ if $@;
}
@@ -136,7 +138,9 @@
[\x{4E00}-\x{9FA5}\x{3007}\x{3021}-\x{3029}]
/x;
- $NameChar = qr/ $BaseChar | $Ideographic | $Digit | [._:-] | $CombiningChar | $Extender /x;
+ $Letter = qr/^ $BaseChar | $Ideographic $/x;
+
+ $NameChar = qr/^ $Letter | $Digit | [._:-] | $CombiningChar | $Extender $/x;
PERL
die $@ if $@;
Modified: trunk/libxml-sax-perl/SAX/PurePerl/Reader.pm
URL: http://svn.debian.org/wsvn/trunk/libxml-sax-perl/SAX/PurePerl/Reader.pm?rev=9846&op=diff
==============================================================================
--- trunk/libxml-sax-perl/SAX/PurePerl/Reader.pm (original)
+++ trunk/libxml-sax-perl/SAX/PurePerl/Reader.pm Tue Nov 27 19:00:01 2007
@@ -4,7 +4,7 @@
use strict;
use XML::SAX::PurePerl::Reader::URI;
-use XML::SAX::PurePerl::Productions qw( $SingleChar );
+use XML::SAX::PurePerl::Productions qw( $SingleChar $Letter $NameChar );
use Exporter ();
use vars qw(@ISA @EXPORT_OK);
Modified: trunk/libxml-sax-perl/SAX/PurePerl/Reader/UnicodeExt.pm
URL: http://svn.debian.org/wsvn/trunk/libxml-sax-perl/SAX/PurePerl/Reader/UnicodeExt.pm?rev=9846&op=diff
==============================================================================
--- trunk/libxml-sax-perl/SAX/PurePerl/Reader/UnicodeExt.pm (original)
+++ trunk/libxml-sax-perl/SAX/PurePerl/Reader/UnicodeExt.pm Tue Nov 27 19:00:01 2007
@@ -16,7 +16,7 @@
}
sub switch_encoding_string {
- $_[0] = Encode::decode($_[1], $_[0]);
+ Encode::from_to($_[0], $_[1], "utf-8");
}
1;
Modified: trunk/libxml-sax-perl/debian/changelog
URL: http://svn.debian.org/wsvn/trunk/libxml-sax-perl/debian/changelog?rev=9846&op=diff
==============================================================================
--- trunk/libxml-sax-perl/debian/changelog (original)
+++ trunk/libxml-sax-perl/debian/changelog Tue Nov 27 19:00:01 2007
@@ -28,6 +28,7 @@
* Update debian/watch.
* Move the examples under debian/, they are Debian-specific.
* Use quilt to manage debian/patches.
+ + charset-decoding: Fix charset decoding in the PurePerl module (#405186)
-- Niko Tyni <ntyni at iki.fi> Sun, 25 Nov 2007 13:20:09 +0200
Added: trunk/libxml-sax-perl/debian/patches/charset-decoding
URL: http://svn.debian.org/wsvn/trunk/libxml-sax-perl/debian/patches/charset-decoding?rev=9846&op=file
==============================================================================
--- trunk/libxml-sax-perl/debian/patches/charset-decoding (added)
+++ trunk/libxml-sax-perl/debian/patches/charset-decoding Tue Nov 27 19:00:01 2007
@@ -1,0 +1,128 @@
+# Fix charset decoding in the PurePerl module (#405186)
+# Niko Tyni <ntyni at iki.fi> Sun, 04 Nov 2007 20:46:58 +0200
+
+diff -urN XML-SAX-0.15-orig/SAX/PurePerl/Productions.pm XML-SAX-0.15-fixed/SAX/PurePerl/Productions.pm
+--- XML-SAX-0.15-orig/SAX/PurePerl/Productions.pm 2003-07-30 16:39:22.000000000 +0300
++++ XML-SAX-0.15-fixed/SAX/PurePerl/Productions.pm 2007-04-23 22:18:24.000000000 +0300
+@@ -4,7 +4,7 @@
+
+ use Exporter;
+ @ISA = ('Exporter');
+- at EXPORT_OK = qw($S $Char $VersionNum $BaseChar $Letter $Ideographic
++ at EXPORT_OK = qw($S $Char $VersionNum $BaseChar $Ideographic
+ $Extender $Digit $CombiningChar $EncNameStart $EncNameEnd $NameChar $CharMinusDash
+ $PubidChar $Any $SingleChar);
+
+@@ -36,12 +36,10 @@
+
+ $Digit = qr/ [\x30-\x39] /x;
+
+- $Letter = qr/^ $BaseChar $/x;
+-
+ # can't do this one without unicode
+ # $CombiningChar = qr/^$/msx;
+
+- $NameChar = qr/^ $BaseChar | $Digit | [._:-] | $Extender $/x;
++ $NameChar = qr/ $BaseChar | $Digit | [._:-] | $Extender /x;
+ PERL
+ die $@ if $@;
+ }
+@@ -138,9 +136,7 @@
+ [\x{4E00}-\x{9FA5}\x{3007}\x{3021}-\x{3029}]
+ /x;
+
+- $Letter = qr/^ $BaseChar | $Ideographic $/x;
+-
+- $NameChar = qr/^ $Letter | $Digit | [._:-] | $CombiningChar | $Extender $/x;
++ $NameChar = qr/ $BaseChar | $Ideographic | $Digit | [._:-] | $CombiningChar | $Extender /x;
+ PERL
+
+ die $@ if $@;
+diff -urN XML-SAX-0.15-orig/SAX/PurePerl/Reader/UnicodeExt.pm XML-SAX-0.15-fixed/SAX/PurePerl/Reader/UnicodeExt.pm
+--- XML-SAX-0.15-orig/SAX/PurePerl/Reader/UnicodeExt.pm 2003-07-30 16:39:23.000000000 +0300
++++ XML-SAX-0.15-fixed/SAX/PurePerl/Reader/UnicodeExt.pm 2007-04-23 22:21:48.000000000 +0300
+@@ -16,7 +16,7 @@
+ }
+
+ sub switch_encoding_string {
+- Encode::from_to($_[0], $_[1], "utf-8");
++ $_[0] = Encode::decode($_[1], $_[0]);
+ }
+
+ 1;
+diff -urN XML-SAX-0.15-orig/SAX/PurePerl/Reader.pm XML-SAX-0.15-fixed/SAX/PurePerl/Reader.pm
+--- XML-SAX-0.15-orig/SAX/PurePerl/Reader.pm 2005-10-14 23:31:20.000000000 +0300
++++ XML-SAX-0.15-fixed/SAX/PurePerl/Reader.pm 2007-04-23 22:17:38.000000000 +0300
+@@ -4,7 +4,7 @@
+
+ use strict;
+ use XML::SAX::PurePerl::Reader::URI;
+-use XML::SAX::PurePerl::Productions qw( $SingleChar $Letter $NameChar );
++use XML::SAX::PurePerl::Productions qw( $SingleChar );
+ use Exporter ();
+
+ use vars qw(@ISA @EXPORT_OK);
+diff -urN XML-SAX-0.15-orig/SAX/PurePerl.pm XML-SAX-0.15-fixed/SAX/PurePerl.pm
+--- XML-SAX-0.15-orig/SAX/PurePerl.pm 2007-02-08 07:24:40.000000000 +0200
++++ XML-SAX-0.15-fixed/SAX/PurePerl.pm 2007-04-23 22:18:59.000000000 +0300
+@@ -670,7 +670,7 @@
+
+ return unless length($name);
+
+- $name =~ /$NameChar/o or $self->parser_error("Name <$name> does not match NameChar production", $reader);
++ $name =~ /^$NameChar+$/o or $self->parser_error("Name <$name> does not match NameChar production", $reader);
+
+ return $name;
+ }
+diff -urN XML-SAX-0.15-orig/t/14encoding.t XML-SAX-0.15-fixed/t/14encoding.t
+--- XML-SAX-0.15-orig/t/14encoding.t 2001-11-19 16:32:09.000000000 +0200
++++ XML-SAX-0.15-fixed/t/14encoding.t 2007-04-23 22:21:03.000000000 +0300
+@@ -1,23 +1,25 @@
+ use Test;
+ BEGIN { $tests = 0;
+- if ($] >= 5.007002) { $tests = 7 }
++ if ($] >= 5.007002) { $tests = 9 }
+ plan tests => $tests;
+ }
+ if ($tests) {
+ use XML::SAX::PurePerl;
+-use XML::SAX::PurePerl::DebugHandler;
+
+-my $handler = XML::SAX::PurePerl::DebugHandler->new();
++my $handler = TestHandler->new(); # see below for the TestHandler class
+ ok($handler);
+
+ my $parser = XML::SAX::PurePerl->new(Handler => $handler);
+ ok($parser);
+
+ # warn("utf-16\n");
++# verify that the first element is correctly decoded
++$handler->{test_elements} = [ "\x{9031}\x{5831}" ];
+ $parser->parse_uri("testfiles/utf-16.xml");
+ ok(1);
+
+ # warn("utf-16le\n");
++$handler->{test_elements} = [ "foo" ];
+ $parser->parse_uri("testfiles/utf-16le.xml");
+ ok(1);
+
+@@ -33,3 +35,19 @@
+ $parser->parse_uri("testfiles/iso8859_2.xml");
+ ok(1);
+ }
++
++package TestHandler;
++use XML::SAX::PurePerl::DebugHandler;
++use base qw(XML::SAX::PurePerl::DebugHandler);
++use Test;
++
++sub start_element {
++ my $self = shift;
++ if ($self->{test_elements} and
++ my $value = pop @{$self->{test_elements}}) {
++ ok($_[0]->{Name}, $value);
++ }
++ $self->SUPER::start_element(@_);
++}
++
++1;
Modified: trunk/libxml-sax-perl/debian/patches/series
URL: http://svn.debian.org/wsvn/trunk/libxml-sax-perl/debian/patches/series?rev=9846&op=diff
==============================================================================
--- trunk/libxml-sax-perl/debian/patches/series (original)
+++ trunk/libxml-sax-perl/debian/patches/series Tue Nov 27 19:00:01 2007
@@ -1,0 +1,1 @@
+charset-decoding
Modified: trunk/libxml-sax-perl/t/14encoding.t
URL: http://svn.debian.org/wsvn/trunk/libxml-sax-perl/t/14encoding.t?rev=9846&op=diff
==============================================================================
--- trunk/libxml-sax-perl/t/14encoding.t (original)
+++ trunk/libxml-sax-perl/t/14encoding.t Tue Nov 27 19:00:01 2007
@@ -1,25 +1,23 @@
use Test;
BEGIN { $tests = 0;
- if ($] >= 5.007002) { $tests = 9 }
+ if ($] >= 5.007002) { $tests = 7 }
plan tests => $tests;
}
if ($tests) {
use XML::SAX::PurePerl;
+use XML::SAX::PurePerl::DebugHandler;
-my $handler = TestHandler->new(); # see below for the TestHandler class
+my $handler = XML::SAX::PurePerl::DebugHandler->new();
ok($handler);
my $parser = XML::SAX::PurePerl->new(Handler => $handler);
ok($parser);
# warn("utf-16\n");
-# verify that the first element is correctly decoded
-$handler->{test_elements} = [ "\x{9031}\x{5831}" ];
$parser->parse_uri("testfiles/utf-16.xml");
ok(1);
# warn("utf-16le\n");
-$handler->{test_elements} = [ "foo" ];
$parser->parse_uri("testfiles/utf-16le.xml");
ok(1);
@@ -35,19 +33,3 @@
$parser->parse_uri("testfiles/iso8859_2.xml");
ok(1);
}
-
-package TestHandler;
-use XML::SAX::PurePerl::DebugHandler;
-use base qw(XML::SAX::PurePerl::DebugHandler);
-use Test;
-
-sub start_element {
- my $self = shift;
- if ($self->{test_elements} and
- my $value = pop @{$self->{test_elements}}) {
- ok($_[0]->{Name}, $value);
- }
- $self->SUPER::start_element(@_);
-}
-
-1;
More information about the Pkg-perl-cvs-commits
mailing list