1. MS Unicode -> generated e.g. by Excel when Saving data as Unicode text
2. UTF8 encoding (standard)
Requirement VIM is compiled with multi_byte support.
check if in VIM normal mode
:echo has('multi_byte')
returns 1
In VIM normal mode to open a file with certain encoding:
:e ++enc=<encoding> <filename>
To save in different encoding:
:w ++enc=<encoding> <filename>
e.g.
open in ucs-2le -> save in utf-8
:e ++enc=ucs-2le /tmp/file_ucs2le.csv
:w ++enc=utf-8 /tmp/file_utf8.csv
It works even if your fileencoding in your .vimrc (_vimrc on Windows) is different and VIM normally would recognize as different encoding from the one you want.
++enc sets fileencoding and not encoding (filencoding is needed when opening or saving the file)
More on Unicode in VIM under
http://vim.wikia.com/wiki/Working_with_Unicode
4 comments:
Your blog is fabulous.
Books and Manual
www.gofastek.com
Post a Comment