On 20/11/2022 11:18, Ihor Radchenko wrote:
Max Nikulin writes:
From my point of view it is a reason to file an Emacs bug because I get
(string-collate-lessp "a" "B" "C" t) ; => t
See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=59275
According to the discussion on debbugs, it looks like we can use
`compare-strings' instead. It will be independent of the system locale
and always follow Unicode rules.
However, I am not sure if ignoring locale is something we really want.
WDYT?
I think we should keep `string-collate-lessp' in the
`org-table-sort-lines' implementation. Users expect sorting accordingly
to their locales. However it is better to add a warning to
`org-table-sort-lines' docstring and to the manual that caseless sort
depends on its implementation in libc, so currently it does not work in
clang/llvm and so e.g. on MacOS.
Concerning the test, I would split the current testcase into 2 parts
depending on WITH-CASE argument, check if caseless collation is
available and skip the related test otherwise.
As to the thread linked to the bug report
https://lists.gnu.org/archive/html/emacs-devel/2022-07/msg00940.html
"case-insensitive string comparison." Tue, 19 Jul 2022 13:27:50 -0400,
there is a link
https://stackoverflow.com/questions/319426/how-do-i-do-a-case-insensitive-string-comparison
unrelated to the issue, but comments and answers there describe a lot of
pitfalls and explain why string comparison ignoring case is not trivial.
(It is a Sisyphean task in some sense, I like the comment on 3 sigmas.)