From: Gisle Aas Date: Sat, 17 Jan 2004 01:29:02 +0000 (-0800) Subject: Re: [perl #24926] chop/~ mangles UTF8 [PATCH] X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d0a21e0008d063055a75cb0839423bc677ec5a5a;p=p5sagit%2Fp5-mst-13.2.git Re: [perl #24926] chop/~ mangles UTF8 [PATCH] Message-ID: (test rewritten to fit in blead) p4raw-id: //depot/perl@22180 --- diff --git a/pp.c b/pp.c index 8898735..6f3703d 100644 --- 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); diff --git a/t/op/bop.t b/t/op/bop.t index d5315a8..f6ef8ef 100755 --- a/t/op/bop.t +++ b/t/op/bop.t @@ -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");