How does Vim specify the presence or absence of a byte-order mark?
‘fileencodings’ option includes “ucs-bom”, Vim will check for a byte-order mark. When writing a file, if the ‘bomb’ option is set, Vim will write a byte-order mark on files whose encoding warrants it. For more information, read :help ‘fileencodings’ :help ‘bomb’ 37.6. What is the ‘fileencoding’ option? The ‘fileencoding’ option defines the particular encoding which Vim will use to write a file. If empty, then the value of the ‘encoding’ option is the default. For more information, read :help ‘fileencoding’ 37.7. What is the ‘fileencodings’ option? The ‘fileencodings’ option defines the heuristics used by Vim when opening an existing file. It is a comma separated list of encodings. A special name, “ucs-bom” is used to indicate that Vim should check for the presence of a byte-order mark; however, it will not be recognised if it comes after “utf-8”. Normally, “ucs-bom” (if present) should be first in the list. When Vim opens a file, it checks it against the encodings listed in ‘fileencodi