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

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

bug#12008: Alphabetic sorting respect user's language and/or locale


From: Eli Zaretskii
Subject: bug#12008: Alphabetic sorting respect user's language and/or locale
Date: Sun, 22 Jul 2012 18:25:20 +0300

> From: Stefan Monnier <monnier@IRO.UMontreal.CA>
> Cc: martin rudalics <rudalics@gmx.at>, 12008@debbugs.gnu.org
> Date: Sun, 22 Jul 2012 06:24:31 -0400
> 
> > A simple way of doing this goes along the following lines:
> >   Lisp_Object enc_str1 = ENCODE_SYSTEM (string1);
> >   Lisp_Object enc_str2 = ENCODE_SYSTEM (string2);
> >   return make_number (strcoll (enc_str1, enc_str2));
> 
> That's probably OK for dired'd sorting but not for sort-subr where we
> need to be independent from the system locale.

How do you mean "independent of the system locale"?  We already have
locale-independent string comparison: compare-strings, string<, etc.
By contrast, sorting strings in collation order is AFAIK inherently
locale-specific.  Or am I missing something?

> So better would be to switch the locale to utf-8 and call strcoll
> without calling ENCODE_SYSTEM (tho of course, only if the strings
> are multibyte).

How will this be different from string< etc., that we already have?

(And btw, AFAIK Dired doesn't sort, it relies on 'ls' to do so, and
'ls' uses 'strcoll' to sort file names.  Only on MS-Windows, where we
use ls-lisp.el, do we need to collate in Lisp as part of Dired.)





reply via email to

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