[Top][All Lists]

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

Re: GNU Emacs 22.0.50 fails to find ä in different ISO Latin encodings

From: Miles Bader
Subject: Re: GNU Emacs 22.0.50 fails to find ä in different ISO Latin encodings
Date: Fri, 22 Sep 2006 19:31:47 +0900

Peter Dyballa <address@hidden> writes:
>       C-s C-q 245 in ISO 8859-16 does not find ``„´´ (U+201E) – mini- 
> buffer tells me that ``¥´´ (\245 in ISO 8859-1) cannot be found.

That's because the numeric code following C-q is _not_ a unicode code
point, it's an Emacs character code.  In Emacs 22 those two things are
very different (in Emacs 23, I guess they are the same, as Emacs 23 uses
unicode for its internal codes).

You can see the "Emacs character code" of a character by hitting C-x =
on top of that character in a buffer.

E.g., C-x = says that ``„´´ has Emacs code 1234576, and indeed entering
`C-s C-q 1234576 RET' successfully searches for „ !  Similarly, the
Emacs code for ¥ is 4245, and that also works correctly following C-q.

> Which is the formula to map octal 0156772 to a Unicode slot/position?
> Octal 0156772 is DDFA in hex, which is different from 5B57, 字's
> position in Unicode.

(encode-char #o156772 'ucs)
  => 23383 (#o55527, #x5b57)

> Or: how can I find the octal value for a given Unicode slot (U+ABCD)?

(decode-char 'ucs #x5b57)
  => 56826 (#o156772, #xddfa)

[There seems to be no such unicode character #xABCD known to Emacs.]

Note that (decode-char 'ucs CODE) continues to work properly in Emacs
23, even though Emacs internal codes are completely different (in Emacs
23, of course, it basically just returns its 2nd argument), so it seems
a good function to use for code portable between Emacs 22 and 23.


*This is the cute bunny virus, please copy this into your sig so it can spread.

reply via email to

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