When I copy non-ascii text from Windows and paste into Emacs, it shows up as an octal sequence. For example, if I paste ä into Emacs it shows up as \344.
I could type C-q 344 to get the ä back in Emacs. That's annoying, but it's tolerable if there's only one character. But if there are many characters turned into octal escape sequences, it would be convenient to run some command on a region to convert everything inside. Is there already such a command? If not, how would you write a function to do it?
[I set my default coding system to utf-8 in my .emacs file, and I use the same .emacs file on Windows and Linux. But the problem only happens when copying from a Windows application into Emacs. Copying from Emacs to another Windows application works fine.]
revert-buffer-with-coding-system
(see it's documentation). Emacs shows the characters this way because you copied them from an environment which was in different coding system (assuming ANSI with so-called high ASCII characters used to render Latin with diacritics), but your buffer must be using something like UTF-8 (for which ASCII characters with high bits set have no meaning, i.e. are invalid).set-clipboard-coding-system
. TryC-h a coding-system
to see what other functions in this group are available.emacs -Q
and if you see the problem there already,M-x report-emacs-bug
.insert-file-literally
(and it was too late to either undo or delete/reinsert the file).