charnames::viacode() was broken, noticed by Jeffrey.
Jarkko Hietaniemi [Sun, 7 Apr 2002 16:29:09 +0000 (16:29 +0000)]
p4raw-id: //depot/perl@15783

lib/charnames.pm
lib/charnames.t

index 549a8c2..6cf46a5 100644 (file)
@@ -199,7 +199,7 @@ sub viacode
 
     if ($code > 0x10FFFF) {
        carp "Unicode characters only allocated up to 0x10FFFF (you asked for $hex)";
-       return "\x{FFFD}";
+       return;
     }
 
     return $viacode{$hex} if exists $viacode{$hex};
@@ -209,8 +209,7 @@ sub viacode
     if ($txt =~ m/^$hex\t\t(.+)/m) {
         return $viacode{$hex} = $1;
     } else {
-       carp "Unknown charcode '$hex'";
-        return "\x{FFFD}";
+        return;
     }
 }
 
index 3123127..6a961c6 100644 (file)
@@ -138,7 +138,7 @@ sub to_bytes {
     print "ok 17\n";
 
     # Unused Hebrew.
-    print "not " unless charnames::viacode(0x0590) eq chr(0xFFFD);
+    print "not " if defined charnames::viacode(0x0590);
     print "ok 18\n";
 }