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

Kuerbis
 2014-07-07 15:53
#176330 #176330
User since
2011-03-20
938 Artikel
BenutzerIn
[default_avatar]
Win XP
Aktive Codepage: 1252.
Perl 5.18.2


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
26
27
28
29
use strict;
use 5.10.1;
use Encode;
use Term::ReadKey;
use Encode::Locale;

Encode::Locale::reinit('cp850');

binmode STDOUT, ":encoding(console_out)";
binmode STDIN, ":encoding(console_in)";

say $Encode::Locale::VERSION;
say $Term::ReadKey::VERSION;

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';
$| = 1;
my $key = ReadKey();
say "|$key|";
ReadMode 'restore';

my $in = <STDIN>;
chomp $in;
say "[$in]";



So sieht die Ausgabe in der Windows Konsole aus:

Code: (dl )
1
2
3
4
5
6
7
8
9
10
1.03
2.31
cp850
cp850
cp850
cp850

|ö|
÷
[÷]

View full thread Term::ReadKey::ReadKey Codierungsfrage