CC: | Shin Kojima <shin [...] kojima.org> |
Subject: | [PATCH 2/2] Fix domain_to_unicode AllowUnassigned param |
Date: | Fri, 7 Sep 2018 11:58:03 +0900 |
To: | bug-Net-IDN-Encode [...] rt.cpan.org |
From: | Shin Kojima <shin [...] kojima.org> |
Signed-off-by: Shin Kojima <shin@kojima.org>
---
lib/Net/IDN/UTS46.pm | 1 -
t/domain_to_unicode.t | 4 +++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/Net/IDN/UTS46.pm b/lib/Net/IDN/UTS46.pm
index 11f5702..77643d1 100644
--- a/lib/Net/IDN/UTS46.pm
+++ b/lib/Net/IDN/UTS46.pm
@@ -114,7 +114,6 @@ sub _process {
_validate_label($l, %param,
'TransitionalProcessing' => 0,
- 'AllowUnassigned' => 0, ## keep the Punycode version
) unless $@;
} else {
_validate_label($l,%param,'_AssumeNFC' => 1);
diff --git a/t/domain_to_unicode.t b/t/domain_to_unicode.t
index 609484a..458b179 100755
--- a/t/domain_to_unicode.t
+++ b/t/domain_to_unicode.t
@@ -3,7 +3,7 @@ use strict;
BEGIN { binmode STDOUT, ':utf8'; binmode STDERR, ':utf8'; }
-use Test::More tests => 1 + 14;
+use Test::More tests => 1 + 15;
use Test::NoWarnings;
use Net::IDN::Encode qw(:all);
@@ -14,6 +14,8 @@ is(eval{domain_to_unicode('XN--MLLER-KVA')} || $@, 'müller', 'single uppercase
is(eval{domain_to_unicode('www.jürg.xn--mller-kva.com', )} || $@, 'www.jürg.müller.com', 'mixed utf8/ace/ascii (to_unicode)');
is(eval{domain_to_unicode('www.a.b。c.d。com', )} || $@, 'www.a.b。c.d。com', 'mixed dots (to_unicode)');
+is(eval{domain_to_unicode("www.xn--4s9h.example", AllowUnassigned => 1)} || $@, "www.\x{1F985}.example", 'Unicode 9.0 emoji');
+
is(eval{domain_to_unicode('www.ä ö ü ß.example', 'UseSTD3ASCIIRules' => 0)}, 'www.ä ö ü ß.example', 'blank (without STD3 rules) (to_unicode)') or diag $@;
is(eval{domain_to_unicode('www.ä ö ü ß.example', 'UseSTD3ASCIIRules' => 1)}, undef, 'blank (without STD3 rules) (to_unicode pass-through)') or diag $@;
is(eval{domain_to_unicode('www.xn-- -7kav3ivb.example', 'UseSTD3ASCIIRules' => 0)}, 'www.ä ö ü ß.example', 'blank (with STD3 rules) (to_unicode)') or diag $@;
--
2.18.0