Hi monks,
I have problems on printing utf8 or big5 with Screen::Term::Win32. I am not sure that's the getch() problem, or the puts() ( as well as print() ) problem.
require Term::Screen::Win32;
use utf8;
binmode STDOUT, ":utf8";
binmode STDIN, ":utf8";
$scr = new Term::Screen::Win32;
unless ($scr) { die " Something's wrong \n"; }
$scr->clrscr();
my @buff;
while ( 1 ) {
my $k = $scr->getch() ;
if ( ord ( $k ) == 13 ) { # dump on Enter
$scr->puts($_) foreach @buff;
print $/;
print scalar ( @buff ) ;
}
else { push @buff, $k } ;
}
I had tried many combinations, like if to use utf8 or not, binmode STD handles or not. use array or direct dump, But whatever it goes, I always get the print widechar warning, and the (Chinese) chars I pushed into the array are incorrectly dumped ever.
Anything I missed here?