Hi all,

On 3/1/07, Yongwei Wu <[EMAIL PROTECTED]> wrote:
Hi Bram,

On 3/1/07, Bram Moolenaar <[EMAIL PROTECTED]> wrote:
>
> Yongwei Wu wrote:
>
> > 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 ----

Thanks, it works for me. (Hi Edward, would you please test whether it
works for you?)

It seems that everything goes well. Then we could release this patch soon. :-)

Sorry for bother you so much with my previous messy work. :-P


One minor comment: "is 99% the same" is very vague (it is far from
true if we count the coding points). I would phrase something like:

            /* We don't support "gb18030", but "cp936" is a good substitute
             * for many practical purposes, thus use that.  It's not an
             * alias to still support conversion between gb18030 and utf-8.
             */

Best regards,

Yongwei

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



Regards,

Edward

Reply via email to