The 5.10 documentation for "pack" says the "c" and "C" are "eight bit" and "octet" but they no longer (always) are.
So it works for values there have more than eight bits too. I'm not convinced that's a problem. It could die or warn, but it's more useful if it doesn't.
At least it works for all eight-bit values. It didn't before 5.10.
use strict; use warnings; use Test::More tests => 4; my $ch = chr(0xA0); utf8::downgrade( my $dn_ch = $ch ); utf8::upgrade( my $up_ch = $ch ); is(unpack('c', $dn_ch), 0xA0-0x100, 'c, internal format 0'); is(unpack('c', $up_ch), 0xA0-0x100, 'c, internal format 1'); is(unpack('C', $dn_ch), 0xA0, 'C, internal format 0'); is(unpack('C', $up_ch), 0xA0, 'C, internal format 1');
5.8.8:
1..4 ok 1 - c, internal format 0 not ok 2 - c, internal format 1 # Failed test 'c, internal format 1' # at 781731.pl line 12. # got: '-62' # expected: '-96' ok 3 - C, internal format 0 not ok 4 - C, internal format 1 # Failed test 'C, internal format 1' # at 781731.pl line 14. # got: '194' # expected: '160' # Looks like you failed 2 tests of 4.
5.10.0:
1..4 ok 1 - c, internal format 0 ok 2 - c, internal format 1 ok 3 - C, internal format 0 ok 4 - C, internal format 1
In reply to Re^6: Parsing UTF-16LE CSV Records Using Text::CSV* (5.10)
by ikegami
in thread Parsing UTF-16LE CSV Records Using Text::CSV*
by Jim
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |