Wikia

Vim Tips Wiki

Changes: OEM to ANSI conversion

Edit

Back to page

(Move categories to tip template)
(Adjust previous/next navigation)
 
Line 3: Line 3:
 
|id=779
 
|id=779
 
|previous=778
 
|previous=778
|next=780
+
|next=781
|created=September 2, 2004
+
|created=2004
 
|complexity=basic
 
|complexity=basic
|author=Anonymous
+
|author=
 
|version=6.0
 
|version=6.0
 
|rating=6/7
 
|rating=6/7

Latest revision as of 10:04, December 2, 2008

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
:wq

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.

ReferencesEdit

CommentsEdit

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:

http://www.joelonsoftware.com/articles/Unicode.html


Around Wikia's network

Random Wiki