On 09/10/2022 22:38, Rudolf Adamkovič wrote:

For the two examples given by Max on Linux, I get on macOS:

printf 'a\nB\n' | LC_COLLATE=C sort
B
a

This is the expected behavior.

printf 'a\nB\n' | LC_COLLATE=en_US.UTF-8 sort
B
a

This one is not consistent with what I see on Linux with glibc.

printf 'a\nB\n' | LC_COLLATE=en_US.UTF-8 sort
a
B

Perhaps you do not have en_US locale generated

locale -a | grep en_US
en_US.utf8

At least sort uses the same "C" locale definition as expected by Org tests. Either Emacs is linked with another libc or there is a bug in Emacs.

printf 'a\nb\n' | LC_COLLATE=C sort
a
b

Sanity test passed for sort. You may try the same set of pairs with `string-collate-lessp'.

I am curious if "POSIX" locale works similar to "C" and "C.UTF-8" in your case
(string-collate-lessp "a" "B" "POSIX" nil)



Reply via email to