这个脚本给了我两倍相同的输出。两者之间是否存在无法生存的utf8
encode
编码?decode
say
#!/usr/bin/env perl
use warnings;
use 5.16.1;
use Encode qw/encode decode/;
my $my_encoding = 'ISO-8859-7';
binmode STDOUT, ":encoding($my_encoding)";
my $var = "\N{GREEK SMALL LETTER TAU}";
$var .= "\N{GREEK SMALL LETTER OMEGA WITH TONOS}";
$var .= "\N{GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA}";
$var = encode( 'utf8', $var );
$var = decode( $my_encoding, $var );
say $var;
my $test = encode( 'utf8', $var, Encode::FB_CROAK );
$var = decode( 'utf8', $test, Encode::FB_CROAK );
say $var;