develooper Front page | perl.perl5.porters | Postings from September 2000

first part of fix to s// ignoring utf8

Thread Next
From:
Marc Lehmann
Date:
September 1, 2000 19:37
Subject:
first part of fix to s// ignoring utf8
Message ID:
20000902043741.A28649@cerebro.laendle
The small patch below (partly?) fixes s// behaviour of marking
substitution results correctly as utf8 with respect to bug 20000819.004.
(The result is still incorrect, despite being flagged as utf8, so the bug
still remains).

However, since s// has a lot of branches (and since it generally doesn't
seem to care for utf8) I think somebody with more knowledge should
thoroughly look into fixing it.

--- pp_ctl.c~	Sat Sep  2 03:39:55 2000
+++ pp_ctl.c	Sat Sep  2 04:32:42 2000
@@ -186,12 +186,16 @@
 	    SvCUR_set(targ, SvCUR(dstr));
 	    SvLEN_set(targ, SvLEN(dstr));
+            if (SvUTF8 (dstr))
+              SvUTF8_on (targ);
+            else
+              SvUTF8_off (targ);
 	    SvPVX(dstr) = 0;
 	    sv_free(dstr);
 
 	    TAINT_IF(cx->sb_rxtainted & 1);
 	    PUSHs(sv_2mortal(newSViv((I32)cx->sb_iters - 1)));
 
-	    (void)SvPOK_only(targ);
+	    (void)SvPOK_only_UTF8(targ);
 	    TAINT_IF(cx->sb_rxtainted);
 	    SvSETMAGIC(targ);
 	    SvTAINT(targ);

-- 
      -----==-                                             |
      ----==-- _                                           |
      ---==---(_)__  __ ____  __       Marc Lehmann      +--
      --==---/ / _ \/ // /\ \/ /       pcg@opengroup.org |e|
      -=====/_/_//_/\_,_/ /_/\_\       XX11-RIPE         --+
    The choice of a GNU generation                       |
                                                         |

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About