in reply to Re^2: "use encoding" behaviour change under Perl 5.10?
in thread "use encoding" behaviour change under Perl 5.10?
The "chr()" and "ord()" functions work on characters, similar to "pack("W")" and "unpack("W")", not "pack("C")" and "unpack("C")". "pack("C")" and "unpack("C")" are methods for emulating byte-oriented "chr()" and "ord()" on Unicode strings. While these methods reveal the internal encoding of Unicode strings, that is not something one normally needs to care about at all.
Being a no-expert at all in that, just hope the following can help to give you or others a good direction:
perl -Mencoding=utf8 -le 'print unpack "C", chr 156' 156
perl -Mencoding=utf8 -M'Encode qw(from_to)' -le '$c = chr 156; from_to($c, "iso-8859-3", "utf-8"); print ord $c' 156
|
|---|