Vim Tips Wiki

OEM to ANSI conversion

Redirected from VimTip779

1,624pages on
this wiki
Add New Page
Talk0 Share
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:

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Also on Fandom

Random Wiki