Reloading a file using a different encoding
Talk0
1,599pages on
this wiki
this wiki
Tip 690 Printable Monobook Previous Next
created 2004 · complexity basic · author Olivier Mengué · version 6.0
You can reload a file using a different encoding if Vim was not able to detect the correct encoding:
:e ++enc=<encoding>
For example, on Windows in western Europe, the default encoding is latin1. However I often use Vim to edit files that must be encoded using the console codepage which is is usually cp850 or cp437. So I reload the file using this command:
:e ++enc=cp850
If you need to do this often, you can map a key to do it for you:
" Press F12 to switch to UTF-8 encoding nnoremap <F12> :e ++enc=utf-8<CR>