From: Abhijit Menon-Sen
Date: Fri, 4 Sep 2009 07:11:56 +0000 (+0530)
Subject: Entity-encode E<0xNNNN> and E<0NNN> correctly
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bf6bfb44d9f2e07e4bd25b8eba2d9132fcec637e;p=p5sagit%2Fp5-mst-13.2.git
Entity-encode E<0xNNNN> and E<0NNN> correctly
Fixes bug #68964 reported by samv, where pod2html encoded E<0x2070> to
&0x2070 and not ⁰. perlpodspec says E<0x2070> should work, but the
code in Pod::Html accepted only E. The new code accepts both, and
processes octal entities correctly as well.
Signed-off-by: Abhijit Menon-Sen
---
diff --git a/lib/Pod/Html.pm b/lib/Pod/Html.pm
index 99f95a9..6174dd7 100644
--- a/lib/Pod/Html.pm
+++ b/lib/Pod/Html.pm
@@ -1575,7 +1575,9 @@ sub process_text1($$;$$){
# E - convert to character
$$rstr =~ s/^([^>]*)>//;
my $escape = $1;
- $escape =~ s/^(\d+|X[\dA-F]+)$/#$1/i;
+ $escape =~ s/^0?x([\dA-F]+)$/#x$1/i
+ or $escape =~ s/^0([0-7]+)$/'#'.oct($1)/ei
+ or $escape =~ s/^(\d+)$/#$1/;
$res = "&$escape;";
} elsif( $func eq 'F' ){
diff --git a/lib/Pod/t/htmlescp.pod b/lib/Pod/t/htmlescp.pod
index dc53ca7..c901314 100644
--- a/lib/Pod/t/htmlescp.pod
+++ b/lib/Pod/t/htmlescp.pod
@@ -11,4 +11,6 @@ Here is some B text, some I plus F
file and something that looks like an EhtmlE tag.
This is some C<$code($arg1)>.
+Some numeric escapes: E<0120> E<0x65> E E<108>
+
=cut
diff --git a/lib/Pod/t/htmlescp.t b/lib/Pod/t/htmlescp.t
index 16503c4..95942cd 100644
--- a/lib/Pod/t/htmlescp.t
+++ b/lib/Pod/t/htmlescp.t
@@ -52,6 +52,7 @@ instead of escaping them as < and >.
Here is some bold text, some italic plus /etc/fstab
file and something that looks like an <html> tag.
This is some $code($arg1)
.
+Some numeric escapes: P e r l