diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/charnames.pm | 16 | ||||
-rw-r--r-- | lib/utf8.pm | 2 |
2 files changed, 9 insertions, 9 deletions
diff --git a/lib/charnames.pm b/lib/charnames.pm index bd97983abc..59350b2df9 100644 --- a/lib/charnames.pm +++ b/lib/charnames.pm @@ -29,17 +29,15 @@ sub charnames { } die "Unknown charname '$name'" unless @off; - # use caller 'encoding'; # Does not work at compile time? - my $ord = hex substr $txt, $off[0] - 4, 4; - if ($^H & 0x8) { - use utf8; - return chr $ord; + if ($^H & 0x10) { # "use byte" in effect? + use byte; + return chr $ord if $ord <= 255; + my $hex = sprintf '%X=0%o', $ord, $ord; + 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 if $ord <= 255; - my $hex = sprintf '%X=0%o', $ord, $ord; - 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; } sub import { diff --git a/lib/utf8.pm b/lib/utf8.pm index 5ddd4ba21a..691de0d630 100644 --- a/lib/utf8.pm +++ b/lib/utf8.pm @@ -1,5 +1,7 @@ package utf8; +$^U = 1; + sub import { $^H |= 0x00000008; $enc{caller()} = $_[1] if $_[1]; |