【发布时间】:2014-02-21 10:02:57
【问题描述】:
我在 Windows 7(32 位)上运行 Active Perl 5.16.3。
我的(短)程序处理输入文本文件(以 UTF-8 编码)。我希望输出编码是 Latin1,所以我的代码是:
open (OUT, '>;encoding(Latin1)', "out.txt") || die "Cannot open output file: $!\n";
print OUT "$string\n";
但生成的文件仍为 UTF-8。我做错了什么?
【问题讨论】:
-
开放模式字符串中真的有分号吗?它应该是一个冒号 -
>:encoding(Latin1)
标签: perl utf-8 character-encoding latin1