in reply to Re: Understanding pack and unpack changes for binary data between 5.8 and 5.10
in thread Understanding pack and unpack changes for binary data between 5.8 and 5.10
...It didn't do that in perl 5.8
Another difference to be aware of is this:
my $s = "\x{1234}\x{5678}"; # string with utf8 flag on print unpack("H*", $s), "\n";
With 5.8 this prints a hexdump of the internal (UTF-8) representation of the string — e.g. useful when debugging encoding issues
e188b4e599b8
while with 5.10, you'd get
3478
i.e. the low-byte values of the codepoints, with the high-byte part being truncated. With warnings enabled, you also get "Character in 'H' format wrapped in unpack at...".
With use bytes, or when explicitly turning off the utf8 flag (update: as shown below), you get the old behaviour. And specifically for debugging encoding issues, Devel::Peek is the recommended alternative since 5.10, because of this difference.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Understanding pack and unpack changes for binary data between 5.8 and 5.10
by ikegami (Patriarch) on Mar 11, 2009 at 15:48 UTC | |
by almut (Canon) on Mar 11, 2009 at 16:23 UTC | |
|
Re^3: Understanding pack and unpack changes for binary data between 5.8 and 5.10
by ikegami (Patriarch) on Mar 12, 2009 at 04:38 UTC | |
by almut (Canon) on Mar 12, 2009 at 09:24 UTC |