summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2002-06-25 15:18:15 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2002-06-25 15:18:15 +0000
commitaefe6dfccddf8cd17a61950ab2c2f527a046180c (patch)
treeeb86cc8880cced4002450b8dbd9bc65b5962378d
parent84cecde127a75f822b4452edaf547563c7f19b13 (diff)
downloadperl-aefe6dfccddf8cd17a61950ab2c2f527a046180c.tar.gz
Unicode s/// buglet found by Gregor Chrupala in perl-unicode.
p4raw-id: //depot/perl@17353
-rw-r--r--pp_hot.c2
-rwxr-xr-xt/op/subst.t26
2 files changed, 26 insertions, 2 deletions
diff --git a/pp_hot.c b/pp_hot.c
index de2dec4464..22c54fcfde 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -2089,6 +2089,8 @@ PP(pp_subst)
SPAGAIN;
}
SvTAINT(TARG);
+ if (doutf8)
+ SvUTF8_on(TARG);
LEAVE_SCOPE(oldsave);
RETURN;
}
diff --git a/t/op/subst.t b/t/op/subst.t
index 8b0a8b0ada..e80ab23e29 100755
--- a/t/op/subst.t
+++ b/t/op/subst.t
@@ -7,7 +7,7 @@ BEGIN {
}
require './test.pl';
-plan( tests => 89 );
+plan( tests => 92 );
$x = 'foo';
$_ = "x";
@@ -372,10 +372,32 @@ ok( $_ eq "C B" && $snum == 12 );
my $l = my $r = $s;
$l =~ s/[^\w]//g;
$r =~ s/[^\w\.]//g;
- is($l, $r, "use utf8");
+ is($l, $r, "use utf8 \\w");
}
my $pv1 = my $pv2 = "Andreas J. K\303\266nig";
$pv1 =~ s/A/\x{100}/;
substr($pv2,0,1) = "\x{100}";
is($pv1, $pv2);
+
+{
+ use utf8;
+ $a = 'Espa&ntilde;a';
+ $a =~ s/&ntilde;/ñ/;
+ like($a, qr/ñ/, "use utf8 RHS");
+}
+
+{
+ use utf8;
+ $a = 'España España';
+ $a =~ s/ñ/&ntilde;/;
+ like($a, qr/ñ/, "use utf8 LHS");
+}
+
+{
+ use utf8;
+ $a = 'España';
+ $a =~ s/ñ/ñ/;
+ like($a, qr/ñ/, "use utf8 LHS and RHS");
+}
+