From: Jarkko Hietaniemi Date: Wed, 16 Oct 2002 18:50:51 +0000 (+0300) Subject: Re: [perl #17951] Strange UTF error X-Git-Tag: accepted/trunk/20130322.191538~25217 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=df68b396123fb8eeaeb7770f8e4d190067a4d6e2;p=platform%2Fupstream%2Fperl.git Re: [perl #17951] Strange UTF error Message-ID: <20021016155051.GB268437@lyta.hut.fi> p4raw-id: //depot/perl@18035 --- diff --git a/lib/utf8_heavy.pl b/lib/utf8_heavy.pl index 50b2d6d..4c5ef27 100644 --- a/lib/utf8_heavy.pl +++ b/lib/utf8_heavy.pl @@ -149,8 +149,10 @@ sub SWASHNEW { no warnings; $extras = join '', grep /^[^0-9a-fA-F]/, @tmp; $list = join '', - sort { hex $a <=> hex $b } - grep {/^([0-9a-fA-F]+)/ and not $seen{$1}++} @tmp; # XXX doesn't do ranges right + map { $_->[1] } + sort { $a->[0] <=> $b->[0] } + map { /^([0-9a-fA-F]+)/; [ hex($1), $_ ] } + grep { /^([0-9a-fA-F]+)/ and not $seen{$1}++ } @tmp; # XXX doesn't do ranges right } if ($none) { diff --git a/t/run/fresh_perl.t b/t/run/fresh_perl.t index 9c2b42f..eb83269 100644 --- a/t/run/fresh_perl.t +++ b/t/run/fresh_perl.t @@ -844,3 +844,17 @@ ok 1 ######## [ID 20020623.009] nested eval/sub segfaults $eval = eval 'sub { eval "sub { %S }" }'; $eval->({}); +######## [perl #17951] Strange UTF error +-W +# From: "John Kodis" +# Newsgroups: comp.lang.perl.moderated +# Subject: Strange UTF error +# Date: Fri, 11 Oct 2002 16:19:58 -0400 +# Message-ID: +$_ = "foobar\n"; +utf8::upgrade($_); # the original code used a UTF-8 locale (affects STDIN) +# matching is actually irrelevant: avoiding several dozen of these +# Illegal hexadecimal digit ' ' ignored at /usr/lib/perl5/5.8.0/utf8_heavy.pl line 152 +# is what matters. +/^([[:digit:]]+)/; +EXPECT