1 use utf8; 2 my $name = '你好'; 3 binmode(STDOUT, ":encoding(gbk)"); 4 print $name," "; 5 6 # #或 7 # use Encode; 8 # my $str='你好'; 9 # $str = encode("gbk", decode("utf-8", $str)); 10 # print $str," ";
1 use utf8; 2 my $name = '你好'; 3 binmode(STDOUT, ":encoding(gbk)"); 4 print $name," "; 5 6 # #或 7 # use Encode; 8 # my $str='你好'; 9 # $str = encode("gbk", decode("utf-8", $str)); 10 # print $str," ";