Not OK 13843
Andreas König [Tue, 8 Jan 2002 14:12:29 +0000 (15:12 +0100)]
Message-ID: <m38zb9c7gi.fsf@anima.de>

p4raw-id: //depot/perl@14135

op.c
t/op/subst.t

diff --git a/op.c b/op.c
index 509569e..e4f84fa 100644 (file)
--- a/op.c
+++ b/op.c
@@ -3131,7 +3131,7 @@ Perl_pmruntime(pTHX_ OP *o, OP *expr, OP *repl)
            p = SvPV(pat, plen);
            pm->op_pmflags |= PMf_SKIPWHITE;
        }
-        if (DO_UTF8(pat) || (PL_hints & HINT_UTF8))
+        if (DO_UTF8(pat))
            pm->op_pmdynflags |= PMdf_UTF8;
        PM_SETRE(pm, CALLREGCOMP(aTHX_ p, p + plen, pm));
        if (strEQ("\\s+", PM_GETRE(pm)->precomp))
@@ -3139,8 +3139,6 @@ Perl_pmruntime(pTHX_ OP *o, OP *expr, OP *repl)
        op_free(expr);
     }
     else {
-        if (PL_hints & HINT_UTF8)
-           pm->op_pmdynflags |= PMdf_UTF8;
        if (pm->op_pmflags & PMf_KEEP || !(PL_hints & HINT_RE_EVAL))
            expr = newUNOP((!(PL_hints & HINT_RE_EVAL)
                            ? OP_REGCRESET
index e5eb85b..e48a1b3 100755 (executable)
@@ -7,7 +7,7 @@ BEGIN {
 }
 
 require './test.pl';
-plan( tests => 87 );
+plan( tests => 88 );
 
 $x = 'foo';
 $_ = "x";
@@ -365,3 +365,12 @@ ok( !s/^([a-z]:)/\u$1/ );
 $_ = "Charles Bronson";
 $snum = s/\B\w//g;
 ok( $_ eq "C B" && $snum == 12 );
+
+{
+    use utf8;
+    my $s = "H\303\266he";
+    my $l = my $r = $s;
+    $l =~ s/[^\w]//g;
+    $r =~ s/[^\w\.]//g;
+    is($l, $r, "use utf8");
+}