开发者

Autodetect console output encoding in perl

I have a perl script that prints some information开发者_Go百科 to console in Russian. Script will be executed on several OSes, so console encoding can be cp866, koi8-r, utf-8, or some other. Is there a portable way to detect console encoding so I can setup STDOUT accordingly so the text is printed correctly?


If you're on Windows, there's Win32::Codepage.


use open ':locale';


  • Term::Detect::Software
  • Term::Encoding
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜