summaryrefslogtreecommitdiff
path: root/lib/charnames.pm
diff options
context:
space:
mode:
authorAndreas König <a.koenig@mind.de>2001-02-23 03:39:03 +0100
committerJarkko Hietaniemi <jhi@iki.fi>2001-02-24 00:20:09 +0000
commit2f430fd223c7b2ef7d6222fad4a2b38ff8c72510 (patch)
treeeebbfad7a54ab60cebae06281c92c1e52b99f038 /lib/charnames.pm
parent2d7c14ee4980d18d982b4709ee152c49510a6872 (diff)
downloadperl-2f430fd223c7b2ef7d6222fad4a2b38ff8c72510.tar.gz
Re: [PATCH] fix for charnames above FFFF
Message-ID: <m3u25mxjns.fsf@ak-71.mind.de> A further efficiency tweak. p4raw-id: //depot/perl@8918
Diffstat (limited to 'lib/charnames.pm')
-rw-r--r--lib/charnames.pm5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/charnames.pm b/lib/charnames.pm
index 0d663082c7..875c0a5a94 100644
--- a/lib/charnames.pm
+++ b/lib/charnames.pm
@@ -34,8 +34,9 @@ sub charnames {
}
die "Unknown charname '$name'" unless @off;
- my $hexlen = 0;
- $hexlen++ while substr($txt, $off[0] - $hexlen - 1, 1) =~ /[0-9a-f]/;
+ my $hexlen = 4; # Unicode guarantees 4-, 5-, or 6-digit format
+ $hexlen++ while
+ $hexlen < 6 && substr($txt, $off[0] - $hexlen - 1, 1) =~ /[0-9a-f]/;
my $ord = hex substr $txt, $off[0] - $hexlen, $hexlen;
if ($^H & $bytes::hint_bits) { # "use bytes" in effect?
use bytes;