I have a text file. I’ve been told to make it UTF8. How can I do that with Vim?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you are editing a file encoded as latin1, you will find that ‘fileencoding’ for that buffer is set to latin1. So you will need to manually set the fileencoding before saving the file.
Also note that UTF8 files often begin with a Byte Order Mark (BOM) which indicates endianness. The BOM is optional but some programs use it exclusively to determine the file encoding. Under certain conditions Vim will write the BOM but sometimes it won’t. To explicitly set the BOM do this:
For more information
:help mbyte-optionsand:help utf8and:help bomb.