开发者

Autodetect console output encoding in perl

开发者 https://www.devze.com 2023-01-02 05:30 出处:网络
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

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

精彩评论

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