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: Eli Zaretskii
Subject: Re: converting octal escape sequences to utf-8 and back
Date: Sun, 29 May 2011 02:47:16 -0400

> From: Michael Welsh Duggan <address@hidden>
> Date: Sun, 29 May 2011 01:40:54 -0400
> Cc: Roland Winkler <address@hidden>
> 
> As Leo says:
> 
> (encode-coding-string "ยง" 'utf-8)
> "\302\247"

This is an illusion: what is produced are 2 bytes, but when Emacs
inserts that into the buffer where the results are displayed, the
bytes are represented as ASCII strings.  Try writing the result to a
file (e.g., with write-region) and you will see that what ends up in
the file is simply the UTF-8 encoding of the character.  This is not
what the OP wanted.

IOW, encode-coding-string produces the encoding specified by its 3rd
argument, not its ASCII representation.



reply via email to

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