in reply to unicode in perl
You're viewing your source as cp1252, but the encoder expects Unicode code points. Your string is really:
0084 <-- A nameless, graphless control char 0071 LATIN SMALL LETTER Q 0079 LATIN SMALL LETTER Y 0084 007B LEFT CURLY BRACKET 007A LATIN SMALL LETTER Z 0084 00B7 MIDDLE DOT 007B LEFT CURLY BRACKET 0084 008F SINGLE SHIFT THREE 0079 LATIN SMALL LETTER Y 0084 00A3 POUND SIGN 007F DELETE 0084 008F SINGLE SHIFT THREE 007E TILDE
You could do
use Encode qw( decode ); print $FH decode('cp1252', "... the string ...");
If you do, Perl will see the string the same way you are viewing it.
However, you should save your source as US-ASCII or UTF-8. Use use utf8; if you do the latter.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: unicode in perl
by paramjit (Novice) on Jun 27, 2011 at 07:43 UTC | |
by ikegami (Patriarch) on Jun 27, 2011 at 07:50 UTC | |
by paramjit (Novice) on Jun 27, 2011 at 07:58 UTC | |
by ikegami (Patriarch) on Jun 27, 2011 at 08:22 UTC | |
by paramjit (Novice) on Jun 27, 2011 at 09:43 UTC | |
|