fix bug where html_unescape would try to unescape non-ascii numerics
Dan Book [Wed, 23 Dec 2015 16:13:38 +0000 (11:13 -0500)]
Changes
META.json
Makefile.PL
lib/DOM/Tiny/Entities.pm
t/entities.t

diff --git a/Changes b/Changes
index 4bc93f7..52c9ae0 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,6 +1,7 @@
 {{$NEXT}}
   - Merge several CSS bugfixes and improvements from Mojolicious 6.31 and 6.32.
   - Merge wrap and wrap_content bugfixes from Mojolicious 6.34.
+  - Fix small html_unescape bug in DOM::Tiny::Entities
 
 0.002     2015-11-09 19:28:42 EST
   - Support perl 5.8 (mst)
index 682ac7e..ee5941e 100644 (file)
--- a/META.json
+++ b/META.json
@@ -4,7 +4,7 @@
       "Dan Book <dbook@cpan.org>"
    ],
    "dynamic_config" : 0,
-   "generated_by" : "Dist::Zilla version 5.041, CPAN::Meta::Converter version 2.150005",
+   "generated_by" : "Dist::Zilla version 5.042, CPAN::Meta::Converter version 2.150005",
    "license" : [
       "artistic_2"
    ],
index 4b415a2..7b1e928 100644 (file)
@@ -1,4 +1,4 @@
-# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.041.
+# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.042.
 use strict;
 use warnings;
 
index db25659..7b76fd4 100644 (file)
@@ -33,7 +33,7 @@ sub html_escape {
 
 sub html_unescape {
   my $str = shift;
-  $str =~ s/&(?:\#((?:\d{1,7}|x[0-9a-fA-F]{1,6}));|(\w+;))/_decode($1, $2)/ge;
+  $str =~ s/&(?:\#((?:[0-9]{1,7}|x[0-9a-fA-F]{1,6}));|(\w+;))/_decode($1, $2)/ge;
   return $str;
 }
 
index e3012d5..7d8f879 100644 (file)
@@ -24,6 +24,9 @@ is html_unescape('foobar&apos;&lt;baz&gt;&#x26;&#34;'), "foobar'<baz>&\"",
 # html_unescape (nothing to unescape)
 is html_unescape('foobar'), 'foobar', 'right HTML unescaped result';
 
+# html_unescape (bengal numbers with nothing to unescape)
+is html_unescape('&#০৩৯;&#x০৩৯;'), '&#০৩৯;&#x০৩৯;', 'no changes';
+
 # html_unescape (UTF-8)
 is html_unescape(decode 'UTF-8', 'foo&lt;baz&gt;&#x26;&#34;&OElig;&Foo;'),
   "foo<baz>&\"\x{152}&Foo;", 'right HTML unescaped result';