Change 16124 by jhi@alpha on 2002/04/24 02:03:08
Subject: New UTF-8 surprise
From: [EMAIL PROTECTED] (Andreas J. Koenig)
Date: Mon, 22 Apr 2002 12:08:48 +0200
Message-ID: <[EMAIL PROTECTED]>
Affected files ...
.... //depot/perl/pp_hot.c#276 edit
.... //depot/perl/t/op/subst.t#30 edit
Differences ...
==== //depot/perl/pp_hot.c#276 (text) ====
Index: perl/pp_hot.c
--- perl/pp_hot.c.~1~ Tue Apr 23 20:15:05 2002
+++ perl/pp_hot.c Tue Apr 23 20:15:05 2002
@@ -2117,7 +2117,14 @@
break;
} while (CALLREGEXEC(aTHX_ rx, s, strend, orig, s == m,
TARG, NULL, r_flags));
- sv_catpvn(dstr, s, strend - s);
+ if (doutf8 && !DO_UTF8(dstr)) {
+ SV* nsv = sv_2mortal(newSVpvn(s, strend - s));
+
+ sv_utf8_upgrade(nsv);
+ sv_catpvn(dstr, SvPVX(nsv), SvCUR(nsv));
+ }
+ else
+ sv_catpvn(dstr, s, strend - s);
(void)SvOOK_off(TARG);
Safefree(SvPVX(TARG));
==== //depot/perl/t/op/subst.t#30 (xtext) ====
Index: perl/t/op/subst.t
--- perl/t/op/subst.t.~1~ Tue Apr 23 20:15:05 2002
+++ perl/t/op/subst.t Tue Apr 23 20:15:05 2002
@@ -7,7 +7,7 @@
}
require './test.pl';
-plan( tests => 88 );
+plan( tests => 89 );
$x = 'foo';
$_ = "x";
@@ -374,3 +374,8 @@
$r =~ s/[^\w\.]//g;
is($l, $r, "use utf8");
}
+
+my $pv1 = my $pv2 = "Andreas J. K\303\266nig";
+$pv1 =~ s/A/\x{100}/;
+substr($pv2,0,1) = "\x{100}";
+is($pv1, $pv2);
End of Patch.