Yongwei Wu wrote: > > 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.
'fileencodings' should also be set, but perhaps it's already OK because of other rules in the option initialization. Needs to be checked. > 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. So basically you want to set 'encoding' to "cp936", but not use the alias. So that most files can be edited without trouble, and conversion still works for people who need the extra characters. Thus instead of falling back to "utf-8" in set_init_1() you would fall back to "cp936". Then no other options need to be set (hopefully). Try this patch: *** ../../vim-7.0.205/src/option.c Tue Oct 17 18:36:03 2006 --- option.c Wed Feb 28 21:52:39 2007 *************** *** 3290,3295 **** --- 3290,3303 ---- * If not, go back to the default "latin1". */ save_enc = p_enc; p_enc = p; + if (STRCMP(p_enc, "gb18030") == 0) + { + /* We don't support "gb18030", but "cp936" is 99% the same, thus + * use that. It's not an alias to still support conversion + * between gb18030 and utf-8. */ + p_enc = vim_strsave((char_u *)"cp936"); + vim_free(p); + } if (mb_init() == NULL) { opt_idx = findoption((char_u *)"encoding"); *** ../../vim-7.0.205/src/mbyte.c Tue Dec 5 22:09:02 2006 --- mbyte.c Tue Feb 27 16:27:44 2007 *************** *** 364,370 **** {"949", IDX_CP949}, {"936", IDX_CP936}, {"gbk", IDX_CP936}, - {"gb18030", IDX_CP936}, /* only 99% the same */ {"950", IDX_CP950}, {"eucjp", IDX_EUC_JP}, {"unix-jis", IDX_EUC_JP}, --- 364,369 ---- -- If evolution theories are correct, humans will soon grow a third hand for operating the mouse. /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ download, build and distribute -- http://www.A-A-P.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///