我尝试在 ma perl 控制台应用程序的输出中使用德语特殊字符:öäüßÖÄÜ,但我失败了。这是一个带有活动代码页 850 的德国 win7 系统。
#!/usr/bin/perl
use warnings;
use strict;
binmode(STDOUT , ":encoding(cp437)" ) if $^O eq 'MSWin32';
#binmode(STDOUT , ":encoding(cp850)" ) if $^O eq 'MSWin32';
#binmode(STDOUT , ":encoding(cp1252)" ) if $^O eq 'MSWin32';
my @sp_chars = qw/ä ö ü ß Ä Ö Ü/;
foreach my $sp_char ( @sp_chars ) {
print "$sp_char\n";
}
我收到如下错误:
"\x{009f}" does not map to cp1252 at umlaute.pl line 12.
"\x{009f}" does not map to cp850 at umlaute.pl line 12.
"\x{00c3}" does not map to cp437 at umlaute.pl line 12.
我怎样才能得到正确的输出?