Vim Tips Wiki

OEM to ANSI conversion

1,612pages on
this wiki
Revision as of 10:04, December 2, 2008 by JohnBot (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Tip 779 Printable Monobook Previous Next

created 2004 · complexity basic · version 6.0

I am using Windows 2000, US system. I have a bunch of text files coming from a DOS machine (OEM charset), with characters above code 127. I would like to convert those files into ANSI charset, so that I can see those characters appropriately everywhere under Windows.

Open the file in Vim and enter these commands:

:set encoding=cp437
:set fileencoding=latin1

You can now reopen the file and the characters should have been converted. I prefer to quit after the conversion so that encoding and fileencoding are reset, but I supopse you can simply set encoding back to latin1.

cp437 is the code page for the OEM charset.



Did the same to transform UNICODE (UTF-8) to Latim-1 (ISO-8859-1) and it worked.

I recommend to anyone having trouble understanding these encodings to read the following article:

Around Wikia's network

Random Wiki