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.
这是中文。
これは日本です。
한국입니다.
ಇದು ಕನ್ನಡ.
link|improve this question

68% accept rate
Jerryjvl: There seems to be Unicode support in GViM. I have not been successful in enabling it to work with >2 languages. vim.org/htmldoc/mbyte.html – Ashwin Jul 22 '09 at 3:20
2  
Your example works just fine when pasted into gvim on Linux. Suggest upgrading OS :-D – derobert Jul 22 '09 at 4:38
feedback

1 Answer

up vote 4 down vote accepted

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.

link|improve this answer
the same is true for any os: you need vim to use the right encoding AND the right font to display the glyphs of the font. so, mark greg's answer 'accepted' :) – akira Sep 22 '09 at 5:13
Thanks Greg! So by setting the encoding as UTF-8 we enable GViM to make sense of the bytes it is reading, but sadly it cannot display all those languages using a single fixed-width font, hence gibberish is displayed. – Ashwin Dec 5 '09 at 7:23
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.