26

How to type a Unicode character by its number, e.g. 0x2E3B for Unicode character U+2E3B (THREE-EM DASH) in Emacs?

2 Answers 2

29

On Emacs 23, type Ctrl+X 8 Enter and then the number, followed by Enter. Learned this from Emacs and Unicode Tips, which describes other methods too (Ctrl+X 8 Enter can be followed by Unicode name as well).

Note that U+2E38 probably does not show up unless you have installed Symbola or Everson Mono and defined one of them as the font to be used by Emacs. There might be other fonts that contain the character but the fileformat.info font support page mentions only these two.

2
  • ⁺¹ for the link: for some reason I was needed to type a characters by a decimal value, and wouln't wanted to recalculate those all for hexadecimal. (I got an ouput of Visual Studio, and it is using for a weird reasons decimal notation) In the link mentioned the way.
    – Hi-Angel
    Oct 10, 2014 at 13:22
  • This method doesn't seem to work if you need to type the character in the minibuffer (my goal is to do a global replace). I get "attempted to use the minibuffer while in minibuffer". The linked page doesn't seem to address this case... Feb 24, 2015 at 20:59
5

The following method (found at http://www.emacswiki.org/emacs/QuotedInsert) works even when the C-x 8 method does not work (e.g., to insert a character in the minibuffer). If you know the hex code, start by setting read-quoted-char-radix to 16 -- for instance, you can type (setq read-quoted-char-radix 16) into a scratch buffer, place point after the right parentheses and hit C-x C-e. If instead you know the decimal value, use 10 instead of 16. If you know the octal value you can skip this step.

Then, to actually insert the character, simply type C-q followed by the number. (Any non-numerical character will terminate the number; if by bad luck the character needs to be immediately followed by a digit, terminate the number using a space and erase the space before proceeding.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .