Batch file encoding conversion with Vim
$ ex filename '+set fenc=utf-8' '+x'
It's basically the same to opening the file using vim, change its encoding (set fenc=utf-8), save (if needed) and quit (x).
The advantage over using other methods (like iconv) is that vim will try to detect automatically the current file encoding.
So, for example you can change all you .html files to Unicode at the same time:
$ find -name '*.html' -exec ex {} '+set fenc=utf-8' '+x' \;
Comment this post
Fields marked with * are required.
1 comment
Ahmed
05/09/2008 | #
Thanks, works perfectly! I've been looking for a way like this to convert a bunch of files to UTF-8 all at once.