1

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?

Conner
  • 30,144
  • 8
  • 52
  • 73
bloody numen
  • 487
  • 6
  • 13

2 Answers2

1

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

Ingo Karkat
  • 167,457
  • 16
  • 250
  • 324
0

Vim must be adding some special characters or changing something in there. 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? That should tell you exactly what gvim has modified about it.

Mu Mind
  • 10,935
  • 4
  • 38
  • 69
  • By standard, it could be only byte-order-mark, but vim, like most text editors, doesn't using it. It's up to text editor to determine encoding (or up to user to manually specify it). As i said before, uft8 and ascii are identical on english symbols, so editor have no chances to find encoding - they are both correct. – keltar Sep 17 '12 at 03:36
  • Thank you.The result is "The two files are identical". Is there something wrong with editplus. – bloody numen Sep 17 '12 at 03:42
  • I'm not positive if the diff site can properly detect encoding differences. I would expect that gvim would have to be changing the file somehow to affect how other editors open it. Or is vim not the only variable? Did you say you could take a file that showed UTF-8 in editplus, save it in gvim, and have editplus switch to calling it ANSI? – Mu Mind Sep 17 '12 at 03:47