tags:

views:

56

answers:

3

When I open a buffer in Emacs containing a German Umlaut (the word "Präsentation" occurs in a string), Emacs automatically converts it to a different encoding as soon as I save the file.

How can I tell Emacs to leave the encoding alone?

+1  A: 

M-x set-buffer-file-coding-system is what you are looking for.

You might also have a look at http://www.delorie.com/gnu/docs/emacs/emacs_221.html.

phimuemue
Thx for the answer. This command sets the encoding explicitly, but I want to leave the encoding as it is, I think that's a different problem. And I want to avoid having to execute a command whenever I encounter a buffer containing "special" characters. Could the real problem be that Emacs initially guesses the file's encoding incorrectly? Maybe setting `file-coding-system-alist` properly could help ...
jellybean
+1  A: 

Perhaps you want find-file-literally.

Sean
Ah, that looks pretty much like it! Thanks a lot.
jellybean
A: 

I don't know whether its a bug in stackoverflow, or you really mean you see an A~ and universal currency symbol in Emacs. If the problem is Emacs displaying the wrong characters, then the following might help:

(prefer-coding-system 'utf-8)
JSON