How to change encoding of a file with vim? (example: to utf8)

Daniel Urstöger
04-10-2013 13:46

This is actual pretty easy, with vim, you just need to run the following command:

:write ++enc=utf-8 utf8.txt

This will let vim write the same file into utf8.txt with UTF-8 encoding.

As an alternative you can also use iconv:

iconv -f utf-16 -t utf-8 file.txt > utf8.txt
Average rating: 0 (0 Votes)

You cannot comment on this entry