Welcome to the Power Users community on Codidact!
Power Users is a Q&A site for questions about the usage of computer software and hardware. We are still a small site and would like to grow, so please consider joining our community. We are looking forward to your questions and answers; they are the building blocks of a repository of knowledge we are building together.
Post History
Occasionally someone* occasionally modifies one of the files I'm responsible for with an archaic tool that decides to convert the updated file to UTF-16 (probably lossless) or an even more archaic...
#1: Initial revision
How do I set UTF8 in a Vim modeline?
Occasionally someone* occasionally modifies one of the files I'm responsible for with an archaic tool that decides to convert the updated file to UTF-16 (probably lossless) or an even more archaic tool that converts the file to Latin1 (ISO-8859-1) (probably lossy). Is there a Vim modeline I can put in these files so that the next time I edit and save the file with Vim, it will automatically convert the file back to UTF-8? (My understanding is that converting to UTF-8 is always lossless, so it should be OK to do this automatically). (The help text for ":help encoding" specifically says that the "encoding" option cannot be used in a modeline. I'm hoping there's some *other* option that *can* be used in a modeline. Perhaps something related to fileencodings ? ). I need to convert the file back to UTF8 so that my version control tools can tell me what really changed -- both the desired updates from the tool and the undesired damage (if any) from the unwanted conversion to Latin1. Version control tools (incorrectly) tell me that the file is completely different on every line when comparing a UTF-16 file to the nearly identical text stored in version control (in UTF-8). *(that someone may be me).