if (dstr) {
c = SvPV(dstr, clen);
doutf8 = DO_UTF8(dstr);
+ /* replacement needing upgrading? */
+ if (DO_UTF8(TARG) && !doutf8) {
+ SV *nsv = newSVpvn(c, clen);
+ if (PL_encoding)
+ sv_recode_to_utf8(nsv, PL_encoding);
+ else
+ sv_utf8_upgrade(nsv);
+ c = SvPV(nsv, clen);
+ }
}
else {
c = Nullch;
}
require './test.pl';
-plan( tests => 92 );
+plan( tests => 108 );
$x = 'foo';
$_ = "x";
is($pv1, $pv2);
{
+ # Gregor Chrupala <gregor.chrupala@star-group.net>
use utf8;
$a = 'España';
$a =~ s/ñ/ñ/;
like($a, qr/ñ/, "use utf8 LHS and RHS");
}
+{
+ # SADAHIRO Tomoyuki <bqw10602@nifty.com>
+
+ $a = "\x{100}\x{101}";
+ $a =~ s/\x{101}/\xFF/;
+ like($a, qr/\xFF/);
+ is(length($a), 2);
+
+ $a = "\x{100}\x{101}";
+ $a =~ s/\x{101}/"\xFF"/e;
+ like($a, qr/\xFF/);
+ is(length($a), 2);
+
+ $a = "\x{100}\x{101}";
+ $a =~ s/\x{101}/\xFF\xFF\xFF/;
+ like($a, qr/\xFF\xFF\xFF/);
+ is(length($a), 4);
+
+ $a = "\x{100}\x{101}";
+ $a =~ s/\x{101}/"\xFF\xFF\xFF"/e;
+ like($a, qr/\xFF\xFF\xFF/);
+ is(length($a), 4);
+
+ $a = "\xFF\x{101}";
+ $a =~ s/\xFF/\x{100}/;
+ like($a, qr/\x{100}/);
+ is(length($a), 2);
+
+ $a = "\xFF\x{101}";
+ $a =~ s/\xFF/"\x{100}"/e;
+ like($a, qr/\x{100}/);
+ is(length($a), 2);
+
+ $a = "\xFF";
+ $a =~ s/\xFF/\x{100}/;
+ like($a, qr/\x{100}/);
+ is(length($a), 1);
+
+ $a = "\xFF";
+ $a =~ s/\xFF/"\x{100}"/e;
+ like($a, qr/\x{100}/);
+ is(length($a), 1);
+}