Emacs creates a file that starts with efbbbf

When I write a file with emacs and try to compile it, I get a weird syntax error.

Then, when I use xxd to get a hexdump of the file I see something like this:

0000000: efbb bf2d 2d20 2449 6424 0a2d 2d20 2448 ...-- $Id$.-- $H

Notice how it starts with a efbb bf. These three bytes tell most programs that the file is unicode. It’s called a Byte Order Mark or BOM. Many editors, like emacs, will automatically write these annoying characters and you can’t always see them in your file..unless you do this…

To make emacs stop writing these characters, it’s necessary to change the coding system of emacs. Here’s how:

Do a C-x RET r and select raw-text. The raw-text encoding in emacs allows you to see the hidden characters. However, there are times when you may not want to see these characters..in such a case use utf-8-with-signature.