为什么Notepad ++在ANSI编码中显示非ASCII字符,但Sublime Text 2不能显示? [英] Why can Notepad++ display non-ASCII characters in ANSI encoding correctly but Sublime Text 2 cannot?

查看:1313
本文介绍了为什么Notepad ++在ANSI编码中显示非ASCII字符,但Sublime Text 2不能显示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在仅包含ASCII字符的记事本++中创建一个新文件,保存它关闭它。
重新打开它在记事本++,检查'编码'菜单,它是'编码在ANSI'。然后我将一些非ASCII字符(例如:中文)添加到文件并保存,它仍然是ANSI编码,但是正确显示(在Windows默认记事本中也是正确的),但是打开带有升华文本2的文件,出现乱码。



当使用升华文本2执行相同的操作时,当输入非ASCII字符时,文件将自动转换为utf-8。



为什么notepad ++和升华文本2的行为不同,为什么notepad ++可以在ANSI编码中显示非ASCII字符?

解决方案

ANSI不是一个编码,是非常模糊的术语。它通常意味着Windows-1252或活动的操作系统代码页,这可能是ANSI / OEM简体中文(PRC,新加坡);简体中文(GB2312)。



Sublime Text 2无法检测UTF-8,UTF-16和ASCII以外的编码。在这种情况下,默认的回退编码是Windows-1252,而不是活动的系统代码页。


I use utf-8 for default encoding for new created file in both notepad++ and sublime text 2.

Create a new file in notepad++ containing only ASCII characters, save it and close it. Reopen it in notepad++, check the 'Encoding' menu, it's 'Encode in ANSI'. Then I add some non-ASCII characters(eg: Chinese) to the file and save it, it's still in ANSI encoding but displayed correctly(also correct in Windows default notepad), but open the file with sublime text 2, messy code appears.

When using sublime text 2 to do the same thing, the file is converted to utf-8 automatically when non-ASCII characters are entered.

So why notepad++ and sublime text 2 behave differently, why can notepad++ display non-ASCII characters in ANSI encoding correctly?

解决方案

ANSI is not an encoding and is very ambiguous term. It usually means Windows-1252 or the active OS code page, which is probably ANSI/OEM Simplified Chinese (PRC, Singapore); Chinese Simplified (GB2312) for you.

Sublime Text 2 cannot detect encodings other than UTF-8, UTF-16 and ASCII. The default fallback encoding in this case is Windows-1252, not the active system code page.

这篇关于为什么Notepad ++在ANSI编码中显示非ASCII字符,但Sublime Text 2不能显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆