La Vita è Bella


Resolved encoding problem in Vim

I've resolved the annoying encoding problem in vim today, and my Vim can handle UTF-8 encoded Chinese files correctly now :)

Just insert the following script into the vimrc file:

set fencs=gb18030,utf-8

In which "fencs" stands for "fileencodings".

The first one (gb18030) will be used for new files. While opening a file, vim will try to convert it use the first one, and the second one if failed, and third...

And I can convert a file between GB18030 and UTF-8 easily with vim now. Just open it, and then set fenc to the desired encoding, then write it, that's all

Vim is pretty good :)

00:19:00 by fishy - Permanent Link

May the Force be with you. RAmen