More charnames tweaks.
authorJarkko Hietaniemi <jhi@iki.fi>
Tue, 28 May 2002 13:32:46 +0000 (13:32 +0000)
committerJarkko Hietaniemi <jhi@iki.fi>
Tue, 28 May 2002 13:32:46 +0000 (13:32 +0000)
p4raw-id: //depot/perl@16835

lib/charnames.pm
lib/charnames.t

index d826cb3..a540d14 100644 (file)
@@ -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
 
index 669f6e8..218cd9a 100644 (file)
@@ -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";