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: Roland Winkler
Subject: Re: converting octal escape sequences to utf-8 and back
Date: Sun, 29 May 2011 01:35:58 -0500

On Sun May 29 2011 Michael Welsh Duggan wrote:
> As Leo says:
> 
> (encode-coding-string "§" 'utf-8)
> "\302\247"
> (decode-coding-string "\302\247" 'utf-8)
> "§"

The decoding seems to work fine this way, but not the encoding.
If I start out with the 8-character ascii string "\302\247" the
following does not give me back this 8-character string:

(with-temp-file "~/foo.txt"
    (insert (encode-coding-string
             (decode-coding-string "\302\247" 'utf-8) 'utf-8)))

This will ask me for the coding system I want, suggesting the
default 'raw-text. Then I end up with a file that has only two
bytes, instead of the eight bytes I want. 

What am I doing wrong? Do I need anything else for this?

Roland



reply via email to

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