Vim utf8 vs latin1

In a Unicode Terminal (uxterm) I first created a file, where encoding was utf8 (for input), and fileencoding was latin1. This works. However if you re-read the file, you will get a conversion error. Wrong.

In uxterm, a new file with encoding latin1 set results in a strange leading space being printed after inputing öäå. Now setting fileencoding as latin1 too, vim(version 6.1) saves results in as a utf8 file. Er, wrong.

Now in Konsole(1.1.3) which touts a Unicode font, but not actual unicode support. I create a file.
vim: encoding=latin1 fileencoding=utf8

It actually takes the proper latin1 input and writes utf8 correctly for troublesome characters like äöå.

Again re-editing the file, the back conversion to latin1 I/O does not happen. So you get garbage displayed for non-ascii characters.

So what’s the point here? It is quite easy to write in an encoding different to that of your input, but not to read it again.

At work in Finland I was trying to implement a policy on webpage encodings to be set as Unicode. As not everyone uses a terminal which supports Unicode, or an editor for that matter. It simply will not work out. :/ Don’t get burnt!

For vim users not cottoned onto this Unicode thing, I suggest you stick with latin1(iso-8859–1) defaults.

First step is to start using a terminal which supports Unicode like uxterm for something like mail.

Once you are comfortable with this, you will need wait until this becomes the default with all your collegues.

Then, only then you can explicitly afford to set in a collaborative environment:
vim: encoding=utf8

Beware of the issues. There are core tools like BASH you use everyday which typically do not support Unicode.

Found any of my content interesting or useful?