Comment 8 for bug 617761

Revision history for this message
Eric Miao (eric.y.miao) wrote : Re: GVIM2 menu doesn't display Chinese character

@An Yang, then apparently we need to change the title to something different. gvim _can_ display GB18030, the problem is really it has moved to use utf-8 internally, and guessing the encoding before read it in according to the list of fileencodings.

:set fileencodings

And you will see the list of default fileencodings being "ucs-bom,utf-8,default,latin1". Now I believe default is the charset of the current locale (most likely being 'UTF-8'), so vim will fall back to latin1 as the last resort, and trying to convert the gb18030 encoded characters internally to utf-8, treating them as latin1 encoded, which is obviously wrong. And once converted to utf-8, setting different encoding by 'set encoding=' won't work as the content of the buffer is already wrong.

One way to work around this,

:set fileencodings=gb18030,ucs-bom,utf-8,default,latin1

This will give vim a chance to convert from gb18030 firstly, and it works for me.