vimcharactereditplus

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


System is Win7

My 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 :

enter image description here

PS: editplus's default character setting is ANSI.

Why?


Solution

  • The beauty of the UTF-8 encoding is that, as long as the text is pure 7-bit ASCII (i.e. only the normal English characters), it is indistinguishable from ANSI / ASCII. So it may be fine that other editors show the file as ANSI.

    When you insert a non-ASCII character (e.g. 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).

    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.)