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

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

Re: Alternative to string< that works "well" with unicode


From: Eli Zaretskii
Subject: Re: Alternative to string< that works "well" with unicode
Date: Fri, 28 Nov 2014 10:25:19 +0200

> From: Rasmus <address@hidden>
> Date: Fri, 28 Nov 2014 01:32:00 +0100
> 
> > I think Emacs bug#18051 is relevant.
> 
> Thanks, the bug pointed me to `string-collate-lessp':
> 
> (sort '(É E T A À Z) 'string-collate-lessp)
>       => (A À E É T Z)
> 
> Pretty cool!

Yes, it is.  But please be aware that the results are heavily
locale-dependent; in particular, a non-UTF-8 locale on a typical
GNU/Linux system might behave very differently.  Likewise on systems
where the standard C library is not glibc.

The upshot of all this is that the results of such sorting are
excellent from the local user POV, but should not be considered as
stable across locales and systems, and therefore Lisp programs that
are expected to be distributed should not rely on the resulting order
too much.




reply via email to

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