emacs-devel
[Top][All Lists]
Advanced

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

Re: `decode-coding-string' question


From: David Kastrup
Subject: Re: `decode-coding-string' question
Date: Sat, 08 Jul 2006 10:18:01 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Paul Pogonyshev <address@hidden> writes:

> David Kastrup wrote:
>> Paul Pogonyshev <address@hidden> writes:
>> 
>> > Eli Zaretskii wrote:
>> >> > To know what character is encoded by this C sequence, I first translate
>> >> > strings "\xc2" and "\xa9" to the appropriate (undecoded!) characters.
>> >> > The resulting string of length 2 is encoded in UTF-8 and I decode it
>> >> > to receive the copyright character or whatever.
>> >> 
>> >> Why not use `(decode-coding-string "\xc2\xa9" 'utf-8)' right away?  It
>> >> gives me the right character directly.
>> >
>> > Because you underquoted the string.  It is actually `(decode-coding-string
>> > "\\xc2\\xa9" 'utf-8)' and does nothing...
>> 
>> Because you overquoted the string...
>
> ...
>
> The buffer contains 8 (eight) characters.  ?\\ ?x ?c ?2 ?\\ ?x ?a ?9.

Yes, I was aware of that.

Let us assume that you fetched the string including the double quotes
into the variable `string'.

Then take a look at (read string).  That should get you the right
amount of backslashes.

Alternatively, assume that point is on the first quote character of
the string.  Then you can use
(read current-buffer)
for reading the string.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum




reply via email to

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