Why does emacs sometimes insert weird characters at the top of my file?
Every so often, when I save a file using emacs I open the file to find a weird string of characters inserted at the beginning of the file. I have noticed this on multiple computers, so I don't believe it is specific to my machine.
I'm running Ubuntu 9.04 with GNU Emacs version 23.1.1.
Here is a sample of what I found today while editing a latex document:
B1;2305;0c\documentclass{article}
\usepackage{graphicx}
\usepackage{hyperref}
开发者_运维百科Am I perhaps closing the file incorrectly?
Are you running Emacs in the shell or under X? That looks like a terminal problem (similar to the escape sequences you see if your terminal doesn't like your cursor keys et al.)
Perhaps it's unicode byte order mark? What does C-h vbuffer-file-coding-system
say? If it's something that ends with "with-signature" (e.g., utf-8-with-signature
), then set it to the none "with-signature" version (M-xset-buffer-file-coding-system
Enter utf-8
).
精彩评论