New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chop/~ mangles UTF8 #7040
Comments
From nwc@faith.mccarroll.org.ukCreated by @nwc10perl5.8.3 -le '$a="\0\x{100}"; chop $a; print ord ~$a' Not that it's a new bug: perl5.8.0 -le '$a="\0\x{100}"; chop $a; print ord ~$a' Perl Info
|
From @gisle"nwc@faith.mccarroll.org.uk (via RT)" <perlbug-followup@perl.org> writes:
It's the complement op that is buggy here. This is a fix: Inline Patch--- pp.c.5.8.3 2004-01-17 10:07:22.000000000 +0100
+++ pp.c 2004-01-17 10:09:48.000000000 +0100
@@ -2406,6 +2406,7 @@
*result = '\0';
result -= nchar;
sv_setpvn(TARG, (char*)result, nchar);
+ SvUTF8_off(TARG);
}
Safefree(result);
SETs(TARG);
--- t/op/bop.t.5.8.3 2004-01-17 10:17:10.000000000 +0100
+++ t/op/bop.t 2004-01-17 10:24:51.000000000 +0100
@@ -9,7 +9,7 @@
@INC = '../lib';
}
-print "1..44\n";
+print "1..46\n";
# numerics
print ((0xdead & 0xbeef) == 0x9ead ? "ok 1\n" : "not ok 1\n");
@@ -184,3 +184,8 @@
print ((~ $neg1 == 0) ? "ok 43\n" : "not ok 43\n");
$neg7 = -7.0;
print ((~ $neg7 == 6) ? "ok 44\n" : "not ok 44\n");
+
+$a = "\0\x{100}"; chop($a);
+print utf8::is_utf8($a) ? "ok 45\n" : "not ok 45\n"; # make sure UTF8 flag is still there
+$a = ~$a;
+print $a eq "\xFF" ? "ok 46\n" : "not ok 46\n"; |
The RT System itself - Status changed from 'new' to 'open' |
From @rgsGisle Aas wrote:
Thanks, applied as #22180. |
From @smpeters
Great, the applied patch works and this can be closed. |
@smpeters - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#24926 (status was 'resolved')
Searchable as RT24926$
The text was updated successfully, but these errors were encountered: