Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using emacs 24.

How can I replace all occurrences of the non-printable Unicode bidi character RTL, whose hexadecimal number is 202e? I want to replace it with the non-printable Unicode bidi character LTR, whose hexadecimal number is 202d?

Could someone give me some guidance?

share|improve this question

migrated from Nov 12 '12 at 22:31

This question came from our site for professional and enthusiast programmers.

This requires enable-recursive-minibuffers is set to non-nil:

M-x replace-regexp RET C-x 8 RET 202e RET RET C-x 8 RET 202d RET RET

share|improve this answer
I didn't know about C-x 8 RET! – user4815162342 Nov 12 '12 at 20:54
Thanks, but unfortunately this solution doesn't work. I still get the message "Replaced 0 occurrences". – Evan Aad Nov 13 '12 at 6:45
@EvanAad: Is it possible the point was after the character to be replaced? – npostavs Nov 18 '12 at 5:09
I've retried and it works! Thanks! – Evan Aad Nov 21 '12 at 14:53
up vote 2 down vote accepted
  1. Add the following piece of emacs Lisp code at the beginning of the buffer:

    (while (re-search-forward "\u202e" nil t)
            (replace-match     "\u202d"))

  2. Place the cursor just after the last parenthesis and type C-xC-e to execute the code.

share|improve this answer
M-x replace-regexp RET \u202e RET \u202d
share|improve this answer
You'd think, wouldn't you!? Unfortunately, running this command on a file that consists of a single unicode character, whose hex number is 202e, yields the following message: "Replaced 0 occurrences" – Evan Aad Nov 12 '12 at 18:55
This one doesn't work for me either, and I don't see why it should be expected to work. – npostavs Nov 18 '12 at 5:15

Type the following:

M-% C-q 20056 RET RET C-q 20055 RET RET

C-q followed by an octal number and RET will insert the character represented by the octal number and discard the RET. To quickly convert hex to octal, type #x202e in a M-: prompt, which will print the resulting number in decimal, octal, and hex.

To enable easier input of decimal numbers, a la GTK's C-S-u binding, I use this in my .emacs:

(global-set-key [(control shift u)]
                (lambda ()
                  (let ((read-quoted-char-radix 16))
                    (call-interactively 'quoted-insert))))
share|improve this answer
Thanks, but i still get "Replaced 0 occurrences". – Evan Aad Nov 13 '12 at 6:47
This does work for me. But I wonder why not just have read-quoted-char-radix always be 16? – npostavs Nov 18 '12 at 5:14
@npostavs I've retried and it still doesn't work for me. – Evan Aad Nov 21 '12 at 14:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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