tags:

views:

391

answers:

3

Hi,

I would like to know how can I set vi to show and work with ASCII extended characters without problem.

Thanks!

+3  A: 

Once the the characters are "extended" it's not ASCII any more.

However: Just use vim. ":help unicode" for more details.

janm
+1  A: 

Vim (which is what vi resolves to on most systems) readily supports extended character sets. You might need to tell Vim which encoding to use, though.

This is controlled by two options:

:set encoding
:set fileencoding

If you have loaded a file that displays incorrectly, you may use :set encoding=<new encoding> to force the appropriate encoding. This changes the interpretation of the characters on the fly. If you want to save the file in another encoding preserving the current interpretation of characters, use set fileencoding=<new encoding> to let Vim save the file in that encoding.

I recommend that you set utf-8 as the default encoding in your .vimrc.

Konrad Rudolph
Thanks Konrad, I did as you commented so getting a bit more into VIM. Yet, when setting the encoding to utf-8 the characters become <e9>, <e1>, <f3>, etc. I've read about setting guifont but when trying to set it I got a not supported message. I'm using VIM 7.0. Thanks!
marc
A: 

I would suggest you to try the following:

  • set the terminal to utf-8 (how to do that depends on your terminal; in PuTTY it's in the Window/Translation menu)

  • set your locale to utf-8 (how to do that depends on your OS; on my Debian box it's set LC_ALL=en_GB.UTF-8 for the current session and sudo dpkg-reconfigure locales for permanent system-wide changes) -- you can check your current locale with locale.

That's how it works for me (using VIM 7.1.314 and no .vimrc).

Heinzi