Thread Term::ReadKey::ReadKey Codierungsfrage (13 answers)
Opened by Kuerbis at 2014-07-06 21:09

Kuerbis
 2014-07-07 11:24
#176324 #176324
User since
2011-03-20
938 Artikel
BenutzerIn
[default_avatar]
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
2
3
4
5
6
7
8
cp1252
cp1252
cp850
cp850

"\x{0094}" does not map to cp850 at ... line 21.
|\x{0094}|
|ö|


und mit cp1252 bekomme ich das:

Code: (dl )
1
2
3
4
5
6
7
cp1252
cp1252
cp1252
cp1252

|÷|
|÷|

View full thread Term::ReadKey::ReadKey Codierungsfrage