Why can Notepad++ display non-ASCII characters in

2019-04-14 19:42发布

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?

1条回答
The star\"
2楼-- · 2019-04-14 20:39

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.

查看更多
登录 后发表回答