Suddenly some of my text files, I'm editing with Emacs
had changed and special characters were shown in a strange way, e. g.
\344
instead of ä
\374
instead of ü
… and so on.
In another file I now have
ü
for ü
ä
for ä
….
(I don't know which event was the cause for that, maybe I've been doing something wrong.)
I'd like to convert the document back to its original state (my standard encoding is UTF-8), so that it is displayed correctly with ä, ö, ü, … but I do not know how to do that with emacs.
Best Answer
If you haven't changed the file, you can try
M-x revert-buffer-with-coding-system
. One oflatin-1
orutf-8
should work, depending on the file.You can also mark the entire file with
C-x h
and then tryM-x recode-region
. It will ask you forText was really in
andBut was interpreted as
. For the first file in your question, it looks like it should belatin-1
andutf-8
, and for the second example it should probably be the other way around,utf-8
andlatin-1
.After you got it right, you can choose which coding system to save the file with using
M-x set-buffer-file-coding-system
(orC-x C-m f
for short).