emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: converting octal escape sequences to utf-8 and back


From: Michael Welsh Duggan
Subject: Re: converting octal escape sequences to utf-8 and back
Date: Sun, 29 May 2011 01:40:54 -0400
User-agent: Gnus/5.110016 (No Gnus v0.16) Emacs/24.0.50 (gnu/linux)

Leo <address@hidden> writes:

> On 2011-05-29 08:27 +0800, Roland Winkler wrote:
>> 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?
>>
>> Thanks a lot,
>>
>> Roland
>
> Are these functions useful?
>
> encode-coding-string, decode-coding-string
> encode-coding-region, decode-coding-region

As Leo says:

(encode-coding-string "§" 'utf-8)
"\302\247"
(decode-coding-string "\302\247" 'utf-8)
"§"

-- 
Michael Welsh Duggan
(address@hidden)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]