代码之家  ›  专栏  ›  技术社区  ›  David Cournapeau

如何在vim中读取sjis编码的文件?

  •  6
  • David Cournapeau  · 技术社区  · 15 年前

    3 回复  |  直到 15 年前
        1
  •  13
  •   ZyX    15 年前

    你不应该想改变 encoding sjis 编码,然后

    1. fileencodings 选项包含 干燥 :把这样的东西放进去 vimrc

      set fileencodings=ucs-bom,utf-8,sjis,default
      
    2. 如果使用此选项vim仍然无法正确识别文件编码,请使用 e ++enc=sjis /path/to/file . 或者,如果文件已经打开,则使用 e! ++enc=sjis (不带文件名)。
        2
  •  0
  •   Benoit    15 年前

    There are a few encodings which are similar, but not exactly the same.  Vim
    treats them as if they were different encodings, so that conversion will be
    done when needed.  You might want to use the similar name to avoid conversion
    or when conversion is not possible:
    
        cp932, shift-jis, sjis
        cp936, euc-cn
    
        3
  •  0
  •   Ken Goh    12 年前

    对我来说,在Ubuntu Linux上的gvm中更改fileencoding(++enc=)工作得很好,但在Windows 7上则不行(都变成了?字符)。但我发现,即使不更改文件编码(默认的ucs bom),我也可以通过更改guifont来显示日语字符:

    set guifont=MS_Gothic:h9:cSHIFTJIS
    

    作为比较,在Linux上,我的guifont是:

    guifont=Monospace 10
    

    显示和输入(使用IBus Anthy IME)都很好。