I'm used to using vim to modify a file's line endings:
$ file file
file: ASCII text, with CRLF line terminators
$ vim file
:set ff=mac
:wq
$ file file
file: ASCII text, with CR line terminators
Is it possible to use a similar process to change a file's unicode encoding? I'm trying the following, which doesn't work:
$ file file.xml
file.xml: Unicode text, UTF-16, little-endian
$ vim file
:set encoding=utf-8
:wq
$ file file.xml
file.xml: Unicode text, UTF-16, little-endian
I saw someone say that he could "set fileencoding=utf-8, then update and write the file, and it works," but I seem to be missing something, or else he was confused. I don't know what he meant by "then update."
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…