develooper Front page | perl.perl5.porters | Postings from October 2002

Re: [perl #17951] Strange UTF error

Thread Previous | Thread Next
From:
Jarkko Hietaniemi
Date:
October 16, 2002 08:51
Subject:
Re: [perl #17951] Strange UTF error
Message ID:
20021016155051.GB268437@lyta.hut.fi
I saw your message about this problem already in comp.lang.perl.moderated,
and prepared a patch.

--- lib/utf8_heavy.pl.dist	2002-10-12 21:15:32.000000000 +0300
+++ lib/utf8_heavy.pl	2002-10-13 03:48:39.000000000 +0300
@@ -149,8 +149,10 @@
 	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) {
--- t/run/fresh_perl.t.dist	2002-10-13 03:19:43.000000000 +0300
+++ t/run/fresh_perl.t	2002-10-13 03:51:01.000000000 +0300
@@ -844,3 +844,17 @@
 ######## [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


-- 
Jarkko Hietaniemi <jhi@iki.fi> http://www.iki.fi/jhi/ "There is this special
biologist word we use for 'stable'.  It is 'dead'." -- Jack Cohen

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About