简体   繁体   中英

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 Ch v buffer-file-coding-system say? If it's something that ends with "with-signature" (eg, utf-8-with-signature ), then set it to the none "with-signature" version ( Mx set-buffer-file-coding-system Enter utf-8 ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM