简体   繁体   English

gvim更改文件字符utf-8,但其他编辑器显示ansi

[英]gvim change file character utf-8, but other editor show ansi

System is Win7 系统是Win7

My vimrc: 我的vimrc:

set encoding=utf-8
set ffs=unix,dos,mac 
set fencs=utf-8,ucs-bom,euc-jp,gb18030,gbk,gb2312,cp936 
set fenc=utf-8

After I save the file with gvim, I open the file in editplus : 用gvim保存文件后,我在editplus中打开文件:

在此处输入图片说明

PS: editplus's default character setting is ANSI. PS:editplus的默认字符设置为ANSI。

Why? 为什么?

The beauty of the UTF-8 encoding is that, as long as the text is pure 7-bit ASCII (ie only the normal English characters), it is indistinguishable from ANSI / ASCII. UTF-8编码的优点在于,只要文本是纯7位ASCII(即仅普通的英语字符),就无法与ANSI / ASCII区分。 So it may be fine that other editors show the file as ANSI. 因此,其他编辑器将文件显示为ANSI可能很好。

When you insert a non-ASCII character (eg A UMLAUT = Ä; you can enter this in Vim as a digraph, pressing Ctrl + K , followed by A : ), other editors should properly detect UTF-8, though (or they will probably show two pieces of garbage instead). 当你插入一个非ASCII字符(如A变音符号= A,你可以在Vim中作为有向图中输入验证,按Ctrl + K,随之而来的 :),其他编辑应正确地检测UTF-8,虽然(或者他们会可能会显示两个垃圾)。

If this were another Unicode encoding, you could help other editors by inserting a byte order mark ( :setlocal bomb in Vim), but for UTF-8, there is no high/low-byte ordering issue, and a BOM is rarely used (and some applications don't cope well with it.) 如果这是另一种Unicode编码,则可以通过插入字节顺序标记 (Vim中的:setlocal bomb )来帮助其他编辑器,但是对于UTF-8,则没有高/低字节顺序问题,并且BOM很少使用(某些应用程序无法很好地应对。)

Vim must be adding some special characters or changing something in there. Vim必须添加一些特殊字符或在其中进行更改。 Can you copy the file off somewhere else then save over it in gvim, and attach both the original and gvim-saved version at http://www.diffchecker.com/ or some site like that? 您能否将文件复制到其他地方,然后保存在gvim中,并在http://www.diffchecker.com/或类似的网站上附加原始版本和gvim保存的版本? That should tell you exactly what gvim has modified about it. 那应该告诉您gvim对其进行了哪些修改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM