Thread Term::ReadKey::ReadKey Codierungsfrage
(13 answers)
Opened by Kuerbis at 2014-07-06 21:09 Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 #!/usr/bin/env perl use warnings; use strict; use 5.10.1; use Encode; use Term::ReadKey; use Encode::Locale; binmode STDOUT, ":encoding(console_out)"; binmode STDIN, ":encoding(console_in)"; say $Encode::Locale::ENCODING_LOCALE; say $Encode::Locale::ENCODING_LOCALE_FS; say $Encode::Locale::ENCODING_CONSOLE_OUT; say $Encode::Locale::ENCODING_CONSOLE_IN; say ""; ReadMode 'cbreak'; my $key = ReadKey(); say "|$key|"; $key = decode( 'console_out', $key ); say "|$key|"; ReadMode 'restore'; Mit cp850 Code: (dl
)
1 cp1252 und mit cp1252 bekomme ich das: |