[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: |
Sat, 21 Jul 2012 19:01:11 +0300 |
> Date: Sat, 21 Jul 2012 16:32:50 +0200
> From: martin rudalics <rudalics@gmx.at>
>
> Currently, specifying alphabetic order for output produced by functions
> like `dired' and `sort-subr' makes that output appear in ASCII-code
> order. This means that such output deviates from the order expected by
> users of Latin-derived alphabets like French, German or Spanish and
> can make working with these functions very awkward.
>
> Please consider adding a predicate which makes it possible to produce
> such output in alphabetic order respecting the language and/or locale
> of the user.
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));
However, there are 2 potential issues with this:
. do typical libc implementations of strcoll handle multibyte
characters correctly, if ENCODE_SYSTEM happens to produce multibyte
encoding, such as UTF-8?
. is the above efficient enough, when ENCODE_SYSTEM is not a no-op
(which it is for UTF-8 locales)?
I don't know the answer to these, mainly to the first. (The
MS-Windows implementation is claimed to handle multibyte strings.)
Anyone?