On 23/11/2022 22:27, Max Nikulin wrote:

(setq lst '("semana" "señor" "sepia"))
(sort lst #'string-lessp) ;         => ("semana" "sepia" "señor")
(sort lst #'string-collate-lessp) ; => ("semana" "señor" "sepia")

On 23/11/2022 17:37, Ihor Radchenko wrote:
Eli even argued that `string-collate-lessp' is strictly worse compared
to more predictable approach. See
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=59275#40

I think, Eli is afraid of the following sort of inconsistency

(string-collate-lessp "z" "ö" "de_DE.UTF-8") ; => nil
(string-collate-lessp "z" "ö" "sv_SE.UTF-8") ; => t

Mixed language example: U+0049 LATIN CAPITAL LETTER I vs. U+0406 CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I

(sort '("Івана" "Ivan" "Термін" "Вони")
      (lambda (a b) (string-collate-lessp a b "uk_UA.UTF-8")))
("Вони" "Івана" "Термін" "Ivan")

(sort '("Івана" "Ivan" "Термін" "Вони")
      (lambda (a b) (string-collate-lessp a b "en_US.UTF-8")))
("Ivan" "Вони" "Івана" "Термін")

I suppose users should get result native to their languages even though others may get another order.


Reply via email to