Rusty Shackelford
Rusty Shackelford

Reputation: 81

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?

Upvotes: 6

Views: 2400

Answers (2)

huaiyuan
huaiyuan

Reputation: 26529

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).

Upvotes: 0

Ulrich Schwarz
Ulrich Schwarz

Reputation: 7727

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.)

Upvotes: 6

Related Questions