If I paste a string from some web page into an Emacs buffer sometimes it will show the Unicode representation of some characters with a backslash and some octal code. How can I convert this to the character representation?


  • 1
    Sounds like there's at least one wrong encoding going on.
    – wasamasa
    May 22, 2015 at 11:12
  • 1
    I would usually try revert-buffer-with-coding-system and try to guess the coding system. Usually, if the guess fails, Emacs will display an information buffer with octal codes for characters, which failed to translated using the selected encoding. Moving the point to those characters and pressing RET will move the point to the place in the buffer, where the character appears, so it makes it easier to guess what it may have been. Sometimes, especially if that's on the web, the file cannot be viewed using one encoding and you'll have to patch it manually.
    – wvxvw
    May 22, 2015 at 21:12

3 Answers 3


Specify whether you are using Emacs in a terminal or GUI Emacs.

  • Use a font in Emacs that can display that Unicode character.

  • If your buffer is Unibyte (single-byte), then consider using multibyte instead. In any case, see the Emacs manual, node Unibyte Mode and the Elisp manual, node Text Representations. Consider using function set-buffer-multibyte to convert the buffer to multibyte. See also (elisp) Disabling Multibyte (not to disable it, but for more info about it).

  • I am using GUI Emacs.
    – dmz73
    May 29, 2015 at 9:53

Copying the whole buffer and pasting it into another new buffer somethimes helps here.


Sometimes characters with a non-UTF-8 encoding are saved to a file that is otherwise UTF-8. These will appear as octal escapes in Emacs. To fix such problem encodings, you can highlight the offending text and run M-x recode-region. It will prompt for the original text encoding, and then ask for how it was interpreted (utf-8 or the output of describe-current-coding-system). You'll have to guess the original encoding based on what you're working with, but as an example I often see Latin-1 or Windows-1252.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.