in reply to Re^2: The Queensrÿche Situation
in thread The Queensrÿche Situation
When you work with Unicode, you should get greater character codes (>=255), not byte sequences, because Perl encapsulates encodings for you. For example,
use utf8; binmode STDOUT, ":utf8"; my $string = "Queensrÿche ы"; printf "%x\t%s\n", ord($_), $_ for split "", $string; __END__ 51 Q 75 u 65 e 65 e 6e n 73 s 72 r ff ÿ 63 c 68 h 65 e 20 44b ы
If you need to work with utf-8 bytes, encode them back:
use utf8; use Encode 'encode'; binmode STDOUT, ":utf8"; my $string = "Queensrÿche ы"; printf "%x\t%s\n", ord($_), $_ for split "", encode utf8 => $string; __END__ 51 Q 75 u 65 e 65 e 6e n 73 s 72 r c3 Ã bf ¿ 63 c 68 h 65 e 20 d1 Ñ 8bBut there would be no point in using utf8 and Encode in this case.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: The Queensrÿche Situation
by Rodster001 (Pilgrim) on Oct 19, 2014 at 21:00 UTC |