Change 22180 by [EMAIL PROTECTED] on 2004/01/19 22:32:27 Subject: Re: [perl #24926] chop/~ mangles UTF8 [PATCH] From: Gisle Aas <[EMAIL PROTECTED]> Date: 17 Jan 2004 01:29:02 -0800 Message-ID: <[EMAIL PROTECTED]> (test rewritten to fit in blead)
Affected files ... ... //depot/perl/pp.c#400 edit ... //depot/perl/t/op/bop.t#21 edit Differences ... ==== //depot/perl/pp.c#400 (text) ==== Index: perl/pp.c --- perl/pp.c#399~22163~ Fri Jan 16 11:24:14 2004 +++ perl/pp.c Mon Jan 19 14:32:27 2004 @@ -2417,6 +2417,7 @@ *result = '\0'; result -= nchar; sv_setpvn(TARG, (char*)result, nchar); + SvUTF8_off(TARG); } Safefree(result); SETs(TARG); ==== //depot/perl/t/op/bop.t#21 (xtext) ==== Index: perl/t/op/bop.t --- perl/t/op/bop.t#20~22163~ Fri Jan 16 11:24:14 2004 +++ perl/t/op/bop.t Mon Jan 19 14:32:27 2004 @@ -9,7 +9,7 @@ @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(~~$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"); End of Patch.