Change 13628 by jhi@alpha on 2001/12/11 19:13:57
Subject: Re: use utf8; with bad utf8
From: Nicholas Clark <[EMAIL PROTECTED]>
Date: Tue, 11 Dec 2001 19:49:21 +0000
Message-ID: <[EMAIL PROTECTED]>
Affected files ...
.... //depot/perl/lib/utf8.t#2 edit
Differences ...
==== //depot/perl/lib/utf8.t#2 (text) ====
Index: perl/lib/utf8.t
--- perl/lib/utf8.t.~1~ Tue Dec 11 12:30:05 2001
+++ perl/lib/utf8.t Tue Dec 11 12:30:05 2001
@@ -3,6 +3,7 @@
BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
+ require './test.pl';
}
# NOTE!
@@ -27,8 +28,7 @@
#
#
-use Test;
-plan tests => 15;
+plan tests => 16;
{
# bug id 20001009.001
@@ -101,3 +101,20 @@
ok($w == 0 && $x eq "\x{100}");
}
+{
+ my $progfile = 'utf' . $$;
+ END {unlink $progfile}
+ open P, ">$progfile" or die "Can't open '$progfile': $!";
+ # Interpolation of hex characters needs to take place now, as we're
+ # testing feeding malformed utf8 into perl. Bug now fixed was an
+ # "out of memory" error. We really need the "" [rather than qq() or q()]
+ # to get the best explosion.
+ print P <<"BANG";
+ use utf8; %a = ("\xE1\xA0"=>"sterling");
+ print 'start'; printf '%x,', ord $_ foreach keys %a; print "end\n";
+BANG
+ print "# Possible delay...\n";
+ my $result = runperl ( verbose => 1, stderr => 1, progfile => $progfile );
+ like ($result,
+ qr/^Malformed UTF-8 character \(2 bytes, need 3\).*start\d+,end$/s);
+}
End of Patch.