1

I'm looking for a way to locate all unicode octal characters in a buffer such as \344 and replace them with ä or \353 with ë, etc.

At the least if I could just locate octal characters using incremental search or a REGEXP search, I could manually replace them.

1

Use query-replace (M-%). When entering the string to replace or the replacement string, you can enter a character using its octal code either of these ways:

  • Type C-q followed by the octal digits - e.g. C-q 344

  • Type C-x 8 RET #o followed by the octal digits - e.g. C-x 8 RET $=#o344

The same possibilities exist for inserting a character to search for during Isearch.

But be aware that octal 344 IS ä - they are exactly the same character. So I expect that you are asking the wrong question.

It's possible that your buffer is in unibyte mode or its encoding or current font does not let the normal glyph (e.g. ä) for the character be displayed, so it is displayed instead using octal escape syntax (e.g. \344).

(It is unlikely that you have a unibyte buffer. But to ensure that your it is not unibyte, set buffer-local variable enable-multibyte-characters to t. See (elisp) Disabling Multibyte for how to tell if your buffer is unibyte.)

(ASCII control characters, such as CONTROL A, are also displayed as octal escapes, if variable ctl-arrow is nil. But that is irrelevant for the characters you are asking about - they are not ASCII control characters.)

0

You can insert characters by their octal code points with C-q.

From docstring for quoted-insert:

If the first character you type after this command is an octal digit, you should type a sequence of octal digits which specify a character code. Any nondigit terminates the sequence. If the terminator is a RET, it is discarded; any other terminator is used itself as input.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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