diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2001-11-02 02:14:46 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-11-02 02:14:46 +0000 |
commit | bfa383d613055a7a37cd2a7c710949ec437a40af (patch) | |
tree | d3fc292df73b7f28b68385797d64c34e59c7457d /lib | |
parent | ef54fa25bf4f09581f3509c1a3f2378c860a680e (diff) | |
download | perl-bfa383d613055a7a37cd2a7c710949ec437a40af.tar.gz |
Make encoding and charnames pragmas coexist.
p4raw-id: //depot/perl@12804
Diffstat (limited to 'lib')
-rw-r--r-- | lib/charnames.pm | 2 | ||||
-rw-r--r-- | lib/encoding.pm | 3 | ||||
-rw-r--r-- | lib/encoding.t | 8 |
3 files changed, 8 insertions, 5 deletions
diff --git a/lib/charnames.pm b/lib/charnames.pm index 787ecf9b05..70d6d17f33 100644 --- a/lib/charnames.pm +++ b/lib/charnames.pm @@ -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 { diff --git a/lib/encoding.pm b/lib/encoding.pm index fd9d19b572..2f4b059839 100644 --- a/lib/encoding.pm +++ b/lib/encoding.pm @@ -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> diff --git a/lib/encoding.t b/lib/encoding.t index 4dee08e69a..923baa7d85 100644 --- a/lib/encoding.t +++ b/lib/encoding.t @@ -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"; + |