Encoding|Batch file encoding conversion with Vim
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' \;
No comments:
Post a Comment