bash Cygwin 终端不显示某些字符?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11050502/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 02:30:19  来源:igfitidea点击:

Cygwin terminal not displaying certain characters?

bashencodingcygwinwindows-1252cp1252

提问by Steven Penny

I am running a stock Cygwin install, with the wgetpackage added.

我正在运行库存 Cygwin 安装,并wget添加了软件包。

If I run a command

如果我运行一个命令

wget -qO- tetristv.com/zapni.tv.php

I get this; notice the incorrect display of characters

我明白了;注意字符显示不正确

session=OTA5Mjc0ODU5OA==&stream=play</a></b><br>#EXTINF:0,?T 1<br><b><a     
href="http://212.80.69.19/stream/vlc.php?id=39&session=OTA5Mjc0ODU5OA==&
stream=play" target="_blank" rel="nofollow">http://212.80.69.19/stream 
/vlc.php?id=39&session=OTA5Mjc0ODU5OA==&stream=play</a></b><br>#EXTINF:0,?T 
2<br><b><a href="http://212.80.69.19/stream/vlc.php?id=40& 
session=OTA5Mjc0ODU5OA==&stream=play" target="_blank" 
rel="nofollow">http://212.80.69.19/stream/vlc.php?id=40&
session=OTA5Mjc0ODU5OA==&stream=play</a></b><br>#EXTINF:0,?T 24<br><b><a 

If I just download the file, everything looks fine in Notepad.

如果我只是下载文件,在记事本中一切正常。

wget tetristv.com/zapni.tv.php

采纳答案by Steven Penny

$ LANG=en_US.CP1252
$ wget -qO- tetristv.com/zapni.tv.php

Result

结果

261&session=NTk1NTg0ODU5OA==&stream=play</a></b><br>#EXTINF:0,Oèko<br><b><a

This also works

这也有效

wget -qO- tetristv.com/zapni.tv.php | iconv -f cp1252

回答by AlG

I'm using stock cygwin in Mintty and have my lang set as LANG=en_US.UTF-8and it's been working fine for me (unfortunately our proxy server is blocking the site you referenced so I can't test that). Check out Internationalizationin the cygwin docs for more help.

我在 Mintty 中使用股票 cygwin 并将我的 lang 设置为LANG=en_US.UTF-8,它对我来说一直很好(不幸的是,我们的代理服务器阻止了您引用的站点,因此我无法对其进行测试)。查看cygwin 文档中的国际化以获得更多帮助。

Edit:verified that this UTF-8 views properly within mintty:

编辑:验证此 UTF-8 在 mintty 中正确查看:

$ cat /d/temp/test.txt                                                                                                              
Creds Go here?