tags:

views:

482

answers:

1

I noticed that most of the time, when using some encoding other than 'the standard english', vim doesn't recognize and does not display characters correctly.
This is most easily seen by opening some ascii graphics, or similar files off the net, which use cp437 code page.

Is there a way to make vim check for encoding when opening a file, and open it with a correct one ?

What encodings do you use, as the most "portable" ones (the ones which the largest amount of users will have least problems with) ?

+3  A: 

Vim needs to detect the encoding, and that's going to be problematic, since files don't often explicitly state their encodings (an obvious exception are XML files with an encoding attribute in the header).

You can force Vim to reload a file with a different encoding thus:

:e ++enc=cp437

and you can set the default encoding in your .vimrc if you wish.

This page has more info and links, especially wrt. editing Unicode. UTF-8 is the most widely-used encoding, and the default you should probably go for.

Brian Agnew