From: Andreas König Date: Fri, 23 Feb 2001 02:39:03 +0000 (+0100) Subject: Re: [PATCH] fix for charnames above FFFF X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2f430fd223c7b2ef7d6222fad4a2b38ff8c72510;p=p5sagit%2Fp5-mst-13.2.git Re: [PATCH] fix for charnames above FFFF Message-ID: A further efficiency tweak. p4raw-id: //depot/perl@8918 --- diff --git a/lib/charnames.pm b/lib/charnames.pm index 0d66308..875c0a5 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;