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

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

bug#20316: 24.5; `string-lessp' doesn't respect value of LC_COLLATE


From: Alexis
Subject: bug#20316: 24.5; `string-lessp' doesn't respect value of LC_COLLATE
Date: Tue, 14 Apr 2015 10:55:53 +1000


Eli Zaretskii <eliz@gnu.org> writes:

Emacs is a multi-lingual editor, and it isn't clear how to apply locale-specific settings, including collation, to text that can potentially include many scripts. E.g., a locale could specify a codeset that doesn't cover characters outside of a particular script, which will produce undefined results if you try using system sorting routines with characters outside of that single script.

Okay, fair point.

Also, using locale-specific sorting would produce different results not only in different locales, but also on different platforms in the same locale, because the implementation of locale collation order differs from platform to platform and from one C library to another.

Huh, okay.

Please also note that locale-sensitive collation order could mean more than just order of characters. E.g., it could specify that punctuation characters or differences in accents should be ignored.

*nod*

So by default, Emacs sorts disregarding locale-specific ordering, basically using the Unicode codepoints of the characters to order them.

This makes sense given what you've said above, but can this still be referred to as 'lexicographic' ordering? To me, 'lexicographic ordering' is ordering as per a dictionary for the relevant language, not by codepoint for an arbitrary encoding. Is this wrong?

You could use the external 'sort' utility in the meantime, if it supports locale-dependent ordering. Once again: the results will be not 100% deterministic, even for the same locale, so your users should "caveat emptor".

*nod* Thanks, i'll pass that on. (And note it for the future.)

May I ask what does that package of yours do that it needs locale-dependent sorting?

The package itself doesn't do it, but the results it produces might subsequently require such sorting. The package is `org-vcard':

   https://github.com/flexibeast/org-vcard

which allows one to import vCards to contacts in Org-based formats (and export contacts from Org-based formats to vCards).

One of the package's users had imported a set of contacts, then expected to be able to sort those contacts according to Croatian rules, using `org-sort' (from `org.el'). However, to quote the user, this resulted in the contacts being sorted:

according to the English alphabet rules where the contact entries which start with Croatian characters (Č,Ć,Đ,Š,Ž) are at the end of the list, iow. after 'Z' entries, although it should go like this:

A,B,C,Č,Ć,D,Dž,Đ,..S,Š,..Z,Ž

Alexis.





reply via email to

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