When I enter "Müller", on the screen appears "M??ller". How could I fix this?
#!/usr/bin/env perl
use warnings;
use 5.012;
use Term::ReadLine;
my $term = Term::ReadLine->new( 'dummy' );
my $con = $term->readline( ': ' );
say $con;
# On the screen:
# : M��ller 开发者_运维问答
# Müller
Apply :utf8
layer to filehandles STDIN
and STDOUT
, and pass them as arguments to Term::ReadLine->new()
:
binmode STDIN, ':utf8';
binmode STDOUT, ':utf8';
my $term = Term::ReadLine->new( 'dummy', \*STDIN, \*STDOUT );
精彩评论