Skip Menu |
 

This queue is for tickets about the Pod-SAX CPAN distribution.

Report information
The Basics
Id: 83866
Status: open
Priority: 0/
Queue: Pod-SAX

People
Owner: Nobody in particular
Requestors: BRIANC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.14
Fixed in: (no value)

Attachments
0001-Handle-octal-and-hexadecimal-entities.patch



Subject: Mishandles octal and hexadecimal entities
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 433
Download (untitled) / with headers
text/plain 433b
man perlpod (for 5.14) states for E<number>: The ASCII/Latin-1/Unicode character with that number. A leading "0x" means that number is hex, as in "E<0x201E>". A leading "0" means that number is octal, as in "E<075>". Otherwise number is interpreted as being in decimal, as in "E<181>". Pod::SAX does not understand octal or hexadecimal entities. What's worse, it treats octal entities as decimal, producing bad output.
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Type: multipart/mixed; boundary="----------=_1362955146-15864-4"
Message-ID: <rt-3.8.HEAD-15864-1362955146-815.83866-0-0 [...] rt.cpan.org>
X-RT-Original-Encoding: utf-8
Content-Length: 0
Content-Disposition: inline
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 554
Download (untitled) / with headers
text/plain 554b
On Sun Mar 10 18:22:17 2013, BRIANC wrote: Show quoted text
> man perlpod (for 5.14) states for E<number>: > > The ASCII/Latin-1/Unicode character with that number. A leading "0x" > means that number is hex, as in "E<0x201E>". A leading "0" means
that Show quoted text
> number is octal, as in "E<075>". Otherwise number is interpreted as > being in decimal, as in "E<181>". > > Pod::SAX does not understand octal or hexadecimal entities. What's > worse, it treats octal entities as decimal, producing bad output.
I've included a patch for this, including a test script.
MIME-Version: 1.0
Subject: 0001-Handle-octal-and-hexadecimal-entities.patch
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Type: text/x-patch; name="0001-Handle-octal-and-hexadecimal-entities.patch"
Content-Disposition: inline; filename="0001-Handle-octal-and-hexadecimal-entities.patch"
Content-Transfer-Encoding: binary
Content-Length: 1649
From c96daeb937be5eb8ae3856e6aa2ff85d7ee9e957 Mon Sep 17 00:00:00 2001 From: "brian m. carlson" <sandals@crustytoothpaste.net> Date: Sun, 10 Mar 2013 22:37:18 +0000 Subject: [PATCH] Handle octal and hexadecimal entities. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> --- lib/Pod/SAX.pm | 8 +++++++- t/17entites.t | 30 ++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 t/17entites.t diff --git a/lib/Pod/SAX.pm b/lib/Pod/SAX.pm index 54dbf5b..de4ea74 100644 --- a/lib/Pod/SAX.pm +++ b/lib/Pod/SAX.pm @@ -505,7 +505,13 @@ sub expand_seq { elsif ($name eq 'E') { my $text = join('', $sequence->parse_tree->children); my $char; - if ($text =~ /^\d+$/) { + if ($text =~ /^0\d+$/) { + $char = chr(oct($text)); + } + elsif ($text =~ /^0x\d+$/) { + $char = chr(hex($text)); + } + elsif ($text =~ /^\d+$/) { $char = chr($text); } else { diff --git a/t/17entites.t b/t/17entites.t new file mode 100644 index 0000000..12f592e --- /dev/null +++ b/t/17entites.t @@ -0,0 +1,30 @@ +use Test; +BEGIN { plan tests => 4 } +use Pod::SAX; +use XML::SAX::Writer; + +my $output = ''; +my $p = Pod::SAX->new( + Handler => XML::SAX::Writer->new( + Output => \$output + ) + ); + +ok($p); +$p->parse_file(\*DATA); +ok($output); +print "$output\n"; +ok($output, qr/<pod>.*<\/pod>/s, "Matches basic pod outline"); +ok($output, qr/paragraph/, "Contains a link"); + +__DATA__ + +=head1 NAME + +SomePod - Some Pod to parse + +=head1 DESCRIPTION + +The word B<< pE<97>rE<0x61>grE<0141>ph >> contains 3 I<a>s. + +=cut -- 1.8.0


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.