rasher has asked for the wisdom of the Perl Monks concerning the following question:
The former outputs 0x00 0xC3 0x8C, the other outputs 0x00 0xCC.$ perl -Mencoding=utf8 -e 'print(pack('n', 204))' $ perl -e 'print(pack('n', 204))'
I would have expected the bahavior of n to be unchanged, and the value of 204 to be unchanged both regardless of encoding. However, one (or both) is modified by the encoding. In which way, I don't understand.
For bonus points: How can I use encoding 'utf8', and still get 0x00 0xCC?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: use encoding affects pack()
by betterworld (Curate) on Aug 10, 2008 at 00:09 UTC | |
by rasher (Acolyte) on Aug 10, 2008 at 00:41 UTC | |
|
Re: use encoding affects pack()
by ikegami (Patriarch) on Aug 10, 2008 at 00:27 UTC | |
|
Re: use encoding affects pack()
by tinita (Parson) on Aug 10, 2008 at 17:31 UTC |