This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make encoding and charnames pragmas coexist.
authorJarkko Hietaniemi <jhi@iki.fi>
Fri, 2 Nov 2001 02:14:46 +0000 (02:14 +0000)
committerJarkko Hietaniemi <jhi@iki.fi>
Fri, 2 Nov 2001 02:14:46 +0000 (02:14 +0000)
p4raw-id: //depot/perl@12804

lib/charnames.pm
lib/encoding.pm
lib/encoding.t

index 787ecf9..70d6d17 100644 (file)
@@ -45,7 +45,7 @@ sub charnames {
     my $fname = substr $txt, $off[0] + 2, $off[1] - $off[0] - 2;
     die "Character 0x$hex with name '$fname' is above 0xFF";
   }
-  return chr $ord;
+  return pack "U", $ord;
 }
 
 sub import {
index fd9d19b..2f4b059 100644 (file)
@@ -66,9 +66,6 @@ If no encoding can be found, C<Unknown encoding '...'> error will be thrown.
 The C<\x..> and C<\0...> in regular expressions are not affected by
 this pragma.  They very probably should.
 
-The charnames pragma ("\N{LATIN SMALL SHARP LETTER S}") does not work
-with this pragma.
-
 =head1 SEE ALSO
 
 L<perlunicode>, L<Encode>
index 4dee08e..923baa7 100644 (file)
@@ -1,4 +1,4 @@
-print "1..9\n";
+print "1..10\n";
 
 use encoding "latin1"; # ignored (overwritten by the next line)
 use encoding "greek";  # iso 8859-7 (no "latin" alias, surprise...)
@@ -43,3 +43,9 @@ print "ok 8\n";
 # the first octet of UTF-8 encoded 0x3af 
 print "not " unless unpack("C", chr(0xdf)) == 0xce;
 print "ok 9\n";
+
+# charnames must still work
+use charnames ':full';
+print "not " unless ord("\N{LATIN SMALL LETTER SHARP S}") == 0xdf;
+print "ok 10\n";
+