May 20, 2009

using different locale in vim than the Gnome-Desktop-Session

The Input-Method-Switcher in OpenSolaris works only, when the desktop session is
started with an UTF-8 locale.

All my files are saved with an ISO-8859-1 locale. So editing files with vim in a
Gnome-Session with UTF-8 destroys the file data.

In OpenSolaris the /usr/bin/vi is a vim implementation.
Vim supports setting encodings.
You can set in your ~/.vimrc the encoding and the files are written with your encoding
Just add
set encoding=iso-8859-15

to your ~/.vimrc and start vim.

If the characters in the terminal are not correct, than you have to set the
encoding of the terminal.
The gnome-terminal and terminator support the changing of the terminal encoding

Here is an example from the terminator-Terminal:

Sorry for the bad quality, but I recorded with Istanbul a screen-session and
made a dump of the replay-display. I didn't get a screenshot when the menu
is open.