help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: How to compare strings?


From: Eli Zaretskii
Subject: Re: How to compare strings?
Date: Sun, 29 Apr 2007 22:38:10 +0300

> From: David Kastrup <dak@gnu.org>
> Date: Sun, 29 Apr 2007 18:23:09 +0200
> 
> how do I compare strings in the sort order of the current language
> environment?

I don't understand the question.  I'm sure you are aware that in the
Emacs internal representation of strings, each character has a
distinct codepoint.  That is, unlike outside Emacs, where the same
code can stand for different characters depending on the locale
(because each locale assumes a certain default encoding of text),
inside Emacs Latin-1 è and Latin-2 č are two different characters
represented by two different codes, even though their respective 8-bit
encodings are identical (\350 or hex E8).  In the above example, these
two internal codes are 2280 and 2408 decimal.  (In Emacs 23, these
codes will change, but will still be different.)

Thus, as long as the string was decoded correctly, comparing such
strings is a simple matter of using string< and its ilk.

> Does Emacs have a concept of sort order depending on language?  If
> not, why not?

Because characters that have different order depending on the language
have different codepoints inside Emacs, and thus the issue doesn't
exist.

Or am I missing something?




reply via email to

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