记事本++可以识别编码? [英] Notepad++ can recognize encoding?

查看:115
本文介绍了记事本++可以识别编码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



当我以Notepad ++打开这个文件时,字符是错误的(记事本++以ANSI编码开始)。



当我设置格式 - >从UTF-8编码菜单 - 一切都很好。



令人担忧的是,Notepad ++可以识别编码,也许某些错误使用 fputcsv 创建的文件?第一个字节或某些东西?

解决方案

自动检测编码不能准确地完成。显式指定编码非常重要。在某些情况下可以猜到,但即使不是100%的确定性。



本文档( Encoding )解释与Notepad ++有关的情况。
他们还指出,如果文件尚未使用字节顺序标记(BOM)保存,则会出现困难。



鉴于您的文件正确显示一旦您手动设置编码,我会说您如何生成和保存文件没有任何问题。您唯一可以检查的是BOM是否被保存,这可能会提高记事本++能够自动检测编码的机会。



值得注意的是,虽然它可能有助于编辑器如记事本++更准确地识别编码,根据Unicode标准文档,不推荐使用BOM。


I created file with UTF-8 encoded content (using PHP fputcsv).

When I open this file in Notepad++ - characters are wrong (Notepad++ starts with ANSI encoding).

When I set Format->"Encode in UTF-8" from menu - everything is fine.

Im worrying, that Notepad++ can recognize encoding somehow, and maybe something is wrong with my file created with fputcsv? First byte or something?

解决方案

Automatically detecting an encoding is not something that can be done accurately. It's pretty much essential that the encoding be specified explicitly. It can be guessed in some cases, but even then not with 100% certainty.

This documentation (Encoding) explains the situation in relation to Notepad++. They also point out that the difficulty arises especially if the file has not been saved with a Byte Order Mark (BOM).

Given that your file displays correctly once you manually set the encoding, I would say there's nothing wrong with how you are generating and saving the file. The only thing you can check for is whether a BOM is being saved, which might improve the chances of Notepad++ being able to automatically detect the encoding.

It's worth noting that although it may help editors like Notepad++ identify the encoding more accurately, according to The Unicode Standard document, the BOM is not recommended.

这篇关于记事本++可以识别编码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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