Re: [perl #24926] chop/~ mangles UTF8 [PATCH]
authorGisle Aas <gisle@aas.no>
Sat, 17 Jan 2004 01:29:02 +0000 (17:29 -0800)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Mon, 19 Jan 2004 22:32:27 +0000 (22:32 +0000)
Message-ID: <lrn08m7wkh.fsf@caliper.activestate.com>
(test rewritten to fit in blead)

p4raw-id: //depot/perl@22180

pp.c
t/op/bop.t

diff --git a/pp.c b/pp.c
index 8898735..6f3703d 100644 (file)
--- a/pp.c
+++ b/pp.c
@@ -2417,6 +2417,7 @@ PP(pp_complement)
              *result = '\0';
              result -= nchar;
              sv_setpvn(TARG, (char*)result, nchar);
+             SvUTF8_off(TARG);
          }
          Safefree(result);
          SETs(TARG);
index d5315a8..f6ef8ef 100755 (executable)
@@ -9,7 +9,7 @@ BEGIN {
     @INC = '../lib';
 }
 
-print "1..143\n";
+print "1..145\n";
 
 # numerics
 print ((0xdead & 0xbeef) == 0x9ead ? "ok 1\n" : "not ok 1\n");
@@ -330,3 +330,8 @@ is(stores($y), 0);
 is(~~$y, "c");
 is(fetches($y), 1);
 is(stores($y), 0);
+
+$a = "\0\x{100}"; chop($a);
+ok(utf8::is_utf8($a)); # make sure UTF8 flag is still there
+$a = ~$a;
+is($a, "\xFF", "~ works with utf-8");