I am trying to configure Emacs to save UTF-8 files with a Byte Order Mark. (Yes, I know that the BOM is evil and unnecessary for UTF-8 files. However, Microsoft has decided they know better, so I want to make sure I'm able to save files with BOM.)
However, for some reason my choice of
buffer-file-coding-system won't stick when I save the file.
I'm using Emacs 24.5.1 on Windows 10. To reproduce:
- Open a file (optionally one that already has a BOM).
(setq buffer-file-coding-system 'utf-8-with-signature)(Or
M-x set-buffer-file-coding-system RET utf-8-with-signature RET.)
C-h v buffer-file-coding-system. It is now set to
utf-8-dos. I also verified that the existing BOM was removed from the file.
Why is this happening, and how can I fix it?