[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: converting octal escape sequences to utf-8 and back
From: |
Stefan Monnier |
Subject: |
Re: converting octal escape sequences to utf-8 and back |
Date: |
Mon, 30 May 2011 19:54:20 -0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
> I am trying to use emacs to interface with a program that treats
> utf-8 characters in its input and output as octal escape sequences.
> So the program's output contains ascii strings like "\302\247",
> which I want to display within Emacs as "§". Likewise, I want to
> feed text containing utf-8 characters such as "§" into this program.
> So I need to convert these utf-8 characters back to their respective
> octal escape sequences. What is the proper way to achieve this?
You can try to convert the \302 and \247 to/from bytes by using `read'
and `prin1' (since Emacs also uses such a notation for its own Elisp
strings). As for converting those bytes to/from chars, just use
(en|de)code-coding-string.
Stefan
Re: converting octal escape sequences to utf-8 and back, Eli Zaretskii, 2011/05/28
Re: converting octal escape sequences to utf-8 and back, Randal L. Schwartz, 2011/05/30
Re: converting octal escape sequences to utf-8 and back,
Stefan Monnier <=