exilepanda has asked for the wisdom of the Perl Monks concerning the following question:
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?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 } ; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to print utf8 char in Term::Screen::Win32 ?
by Anonymous Monk on Mar 18, 2012 at 07:59 UTC | |
by exilepanda (Friar) on Mar 21, 2012 at 02:59 UTC |