开发者

Removing byte-order marks (BOMs) using Emacs

I have a file containing UTF-8 encoded text with a byte-order mark. This BOM is getting in the way of things, and I'd like to remove 开发者_如何学运维it.

Resorting to either other tools, such as perl or awk, or weird editing modes, such as hexl-mode, every time I want to get rid of a BOM is somewhat annoying.

Is there a way to tell Emacs to remove the existing BOM and not to write it out to disk again on subsequent saves?


Setting coding-system-for-write directly is a bit of a hack. The user command for changing a file's encoding (in this case from utf-8-with-signature to plain utf-8) is set-buffer-file-coding-system. It is bound by default to C-x RET f.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜