Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.
这是中文。
これは日本です。
한국입니다.
ಇದು ಕನ್ನಡ.
share|improve this question
    
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
3  
Your example works just fine when pasted into gvim on Linux. Suggest upgrading OS :-D –  derobert Jul 22 '09 at 4:38
add comment

3 Answers

up vote 5 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.

share|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
add comment

Using the following settings in your .vimrc
:set encoding=utf-8
:set guifont=*
:set guifontwide=*

may work for you. It worked for me for chinese/japanese characters.

share|improve this answer
    
You can also try the following: :set fileencoding=utf-8 :set fileencodings=ucs-bom,utf-8,latin1 :set *encoding=utf-8 –  GuruM Aug 7 '12 at 11:05
add comment

The font Arial Unicode MS supports japanese, chinese and korean as well as vietnamese and arabic. You could try using that font, though I don't believe it is monospaced.

http://www.microsoft.com/typography/fonts/font.aspx?FMID=1081

There may be other pan-language fonts out there, perhaps monospaced ones as well, but I don't know of them.

edit

I found this page with a few fonts that support all three languages. Some of them are available as free downloads: http://www.wazu.jp/gallery/Fonts_Japanese.html

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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