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));
}
require './test.pl';
-plan( tests => 88 );
+plan( tests => 89 );
$x = 'foo';
$_ = "x";
$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);