summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/charnames.pm10
-rw-r--r--lib/charnames.t8
2 files changed, 13 insertions, 5 deletions
diff --git a/lib/charnames.pm b/lib/charnames.pm
index d826cb3e40..a540d14f7f 100644
--- a/lib/charnames.pm
+++ b/lib/charnames.pm
@@ -203,7 +203,7 @@ sub viacode
}
if ($code > 0x10FFFF) {
- carp "Unicode characters only allocated up to 0x10FFFF (you asked for $hex)";
+ carp sprintf "Unicode characters only allocated up to U+10FFFF (you asked for U+%X)", $hex;
return;
}
@@ -415,8 +415,12 @@ will also give a warning about being deprecated.
=head1 ILLEGAL CHARACTERS
-If you ask for a character that does not exist, a warning is given
-and the Unicode I<replacement character> "\x{FFFD}" is returned.
+If you ask by name for a character that does not exist, a warning is
+given and the Unicode I<replacement character> "\x{FFFD}" is returned.
+
+If you ask by code for a character that does not exist, no warning is
+given and C<undef> is returned. (Though if you ask for a code point
+past U+10FFFF you do get a warning.)
=head1 BUGS
diff --git a/lib/charnames.t b/lib/charnames.t
index 669f6e813d..218cd9ad98 100644
--- a/lib/charnames.t
+++ b/lib/charnames.t
@@ -12,7 +12,7 @@ BEGIN {
$| = 1;
-print "1..42\n";
+print "1..44\n";
use charnames ':full';
@@ -226,7 +226,6 @@ print "ok 38\n";
print "ok 39\n";
}
-
print "not " unless ord("\N{ZWNJ}") == 0x200C;
print "ok 40\n";
@@ -236,3 +235,8 @@ print "ok 41\n";
print "not " unless "\N{U+263A}" eq "\N{WHITE SMILING FACE}";
print "ok 42\n";
+print "not " if defined charnames::viacode(0x110000);
+print "ok 43\n";
+
+print "not " if grep { /you asked for U+110000/ } @WARN;
+print "ok 44\n";