Vim: How to handle Unicode files with text in multiple (more than two) languages

unicodevim

What settings do I need to set in Vim/gVim to be able to view Unicode text files which have text in many languages?

You may make these assumptions:

  • The number of languages is more than two.
  • Some of the languages are Chinese, Japanese, and Korean.
  • It is enough if I can view these files in gVim (not necessarily Vim).
  • gVim 7.0 running on Windows.

Here is a text sample, which when saved in Unicode opens fine in Notepad, but shows up as gibberish in gVim:

This is English.
这是中文。
これは日本です。
한국입니다.
ಇದು ಕನ್ನಡ.

Best Answer

Using gVim on Windows, I did the following two things:

:set encoding=utf-8
:set guifont=*

The second command brings up a font picker. By choosing the font "@MS Mincho", I got some of the Japanese characters to display, but oddly they were rotated 90 degrees to the left.

Anyway, you'll have to set the encoding before loading or pasting text into gVim (otherwise it might just convert them to all question marks). Then you'll have to find a font that is (a) fixed width, and (b) includes the characters you want to see. I don't seem to have such a font on my system at the moment, but you may.

Related Question