Hi Bram,

On 2/27/07, Bram Moolenaar <[EMAIL PROTECTED]> wrote:

Yongwei Wu wrote:

> > > On 2/27/07, Bram Moolenaar <[EMAIL PROTECTED]> wrote:
> > > >
> > > > If I understand it correctly is GB18030 a multi-byte character set that
> > > > is mostly the same as cp936, but adds a number of 4-byte characters.
> > > > Vim does not support those 4-byte characters, thus setting 'encoding' to
> > > > gb18030 won't work.
> > > >
> > > > But conversion between gb18030 and utf-8 should work, thus when
> > > > 'encoding' is utf-8 it should be possible to use gb18030 in
> > > > 'fileencodings' and 'fileencoding'.  Perhaps you can check if that
> > > > works.
> > >
> > > No, with Patch 58 Vim regards gb18030 as an alias for cp936, and
> > > gb18030 does not work at all: this is the major problem.
> >
> > Please be specific: What do you mean with "does not work at all"?
>
> As I said, Vim regards gb18030 as cp936 after Patch 58. I.e., "e
> ++enc=gb18030" is equivalent to "e ++enc=cp936" now. One cannot
> correctly open in Vim a file encoded in GB18030, and the 4-byte
> encoded characters will not be correct.

Since Vim does not support gb18030 for 'encoding', and using "gbk" or
"cp936" will not support the 4-byte characters either, the only way
would be to set 'encoding' to "utf-8".  The current solution to set
'encoding' to "cp936" works only for most characters, not all.

Yes, it is expected. That is mainly to deal with the special
zh_CN.GB18030 case in order not to surprise people that do not know
how to customize their Vim encoding settings.

It would be possible to make a special case for GB18030 in set_init_1().
This would set 'encoding' to "utf-8" and 'termencoding' to "GB18030".
Perhaps you can try these settings and check if everything works:
translated menus, input methods, using Vim in a terminal (if a GB18030
terminal exists), etc.

It is a viable solution, but it is complicated. I have no access to a
GB18030 terminal currently, but I can speculate that in order to
achieve the "no surprise" principle, you will have to change
fileencoding and fileencodings too so that people can open a
GB18030/GBK file without setting any Vim options.

My main point is that if our purpose is to make Vim novices edit
Simplified Chinese files (almost always encoded in GBK) without
troubles in the zh_CN.GB18030 environment, a hack to set encoding to
CP936 will be enough for all practical purposes. Vim veterans will
know how to have their way around. My objection to Patch 58 is only
that it *disabled* Vim veteran's possibility to edit GB18030 files.

Best regards

Yongwei

--
Wu Yongwei
URL: http://wyw.dcweb.cn/

Reply via email to