summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2002-10-16 21:50:51 +0300
committerhv <hv@crypt.org>2002-10-20 13:39:09 +0000
commitdf68b396123fb8eeaeb7770f8e4d190067a4d6e2 (patch)
tree8df252f65b990aa9472adff1cddf853715c3c3af
parent3f2ee0069d15f7a7d413167c0ad86d1545e6b534 (diff)
downloadperl-df68b396123fb8eeaeb7770f8e4d190067a4d6e2.tar.gz
Re: [perl #17951] Strange UTF error
Message-ID: <20021016155051.GB268437@lyta.hut.fi> p4raw-id: //depot/perl@18035
-rw-r--r--lib/utf8_heavy.pl6
-rw-r--r--t/run/fresh_perl.t14
2 files changed, 18 insertions, 2 deletions
diff --git a/lib/utf8_heavy.pl b/lib/utf8_heavy.pl
index 50b2d6d366..4c5ef27a7f 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 9c2b42fc03..eb832693d8 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" <kodis@mail630.gsfc.nasa.gov>
+# Newsgroups: comp.lang.perl.moderated
+# Subject: Strange UTF error
+# Date: Fri, 11 Oct 2002 16:19:58 -0400
+# Message-ID: <pan.2002.10.11.20.19.48.407190@mail630.gsfc.nasa.gov>
+$_ = "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