in reply to Re^5: Parsing UTF-16LE CSV Records Using Text::CSV* (5.10)
in thread Parsing UTF-16LE CSV Records Using Text::CSV*
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: Parsing UTF-16LE CSV Records Using Text::CSV* (5.10)
by tye (Sage) on Jul 20, 2009 at 19:16 UTC | |
by ikegami (Patriarch) on Jul 20, 2009 at 19:34 UTC | |
by tye (Sage) on Jul 20, 2009 at 20:09 UTC | |
by ikegami (Patriarch) on Jul 20, 2009 at 20:34 UTC |