summaryrefslogtreecommitdiff
path: root/lib/Pod
diff options
context:
space:
mode:
authorAbhijit Menon-Sen <ams@toroid.org>2009-09-04 12:41:56 +0530
committerAbhijit Menon-Sen <ams@toroid.org>2009-09-04 12:41:56 +0530
commitbf6bfb44d9f2e07e4bd25b8eba2d9132fcec637e (patch)
treef624e00db3a6a24168d0b9747752efe8ca0c4341 /lib/Pod
parent821005df620220206ad90d589e3049bcfbf0b3db (diff)
downloadperl-bf6bfb44d9f2e07e4bd25b8eba2d9132fcec637e.tar.gz
Entity-encode E<0xNNNN> and E<0NNN> correctly
Fixes bug #68964 reported by samv, where pod2html encoded E<0x2070> to &0x2070 and not &#x2070. perlpodspec says E<0x2070> should work, but the code in Pod::Html accepted only E<x2070>. The new code accepts both, and processes octal entities correctly as well. Signed-off-by: Abhijit Menon-Sen <ams@toroid.org>
Diffstat (limited to 'lib/Pod')
-rw-r--r--lib/Pod/Html.pm4
-rw-r--r--lib/Pod/t/htmlescp.pod2
-rw-r--r--lib/Pod/t/htmlescp.t1
3 files changed, 6 insertions, 1 deletions
diff --git a/lib/Pod/Html.pm b/lib/Pod/Html.pm
index 99f95a9210..6174dd7457 100644
--- a/lib/Pod/Html.pm
+++ b/lib/Pod/Html.pm
@@ -1575,7 +1575,9 @@ sub process_text1($$;$$){
# E<x> - 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 dc53ca75a0..c901314c76 100644
--- a/lib/Pod/t/htmlescp.pod
+++ b/lib/Pod/t/htmlescp.pod
@@ -11,4 +11,6 @@ Here is some B<bold> text, some I<italic> plus F</etc/fstab>
file and something that looks like an E<lt>htmlE<gt> tag.
This is some C<$code($arg1)>.
+Some numeric escapes: E<0120> E<0x65> E<x72> E<108>
+
=cut
diff --git a/lib/Pod/t/htmlescp.t b/lib/Pod/t/htmlescp.t
index 16503c4d95..95942cdf9e 100644
--- a/lib/Pod/t/htmlescp.t
+++ b/lib/Pod/t/htmlescp.t
@@ -52,6 +52,7 @@ instead of escaping them as &lt; and &gt;.</p>
<p>Here is some <strong>bold</strong> text, some <em>italic</em> plus <em class="file">/etc/fstab</em>
file and something that looks like an &lt;html&gt; tag.
This is some <code>$code($arg1)</code>.</p>
+<p>Some numeric escapes: &#80; &#x65; &#x72; &#108;</p>
</body>