Hello,
Attached is my test program for strcoll.
It is slightly big, but mostly because of additional help and debug printing.
This will also become relevant when we deal with multibyte sort/join/uniq later
on.
From brief testing, it seems glibc with UTF-8 locales is the only libc that has
special collation order for non-letters/punctuation characters.
As Andreas Schwab explained:
"They are not ignored, just considered only secondary, if the first order
characters didn't provide an ordering.".
http://lists.gnu.org/archive/html/bug-coreutils/2016-06/msg00005.html
Interestingly, "ja_JP.UTF-8" is the only locale in glibc that uses a different
order than all other UTF-8 locales, and its ordering is more "intuitive"
(closer to ascii).
Testing results from various systems are below.
The program is also available for download here:
wget http://files.housegordon.org/src/strcoll-test.c
Compilation is trivial:
cc -o strcoll-test strcoll-test.c
Usage is:
Usage: ./strcoll-test [-svl] [[-KM] | TEXT1 TEXT2 TEXTn...]
Sorts TEXT1 TEXT2 TEXTn... according to the currently
active locale using strcoll(3) call.
If no parameters are specified, assumes '-M' instead.
Options:
-s print result of each strcoll(3) call
-v print uname/glibc version information (if available)
-l print active local name
-K use input from https://debbugs.gnu.org/23677
-M use input from https://debbugs.gnu.org/24601 (default)
Use LC_ALL to set locale.
Examples:
$ ./strcoll-test -ls '!a' '$z' '#c'
active locale: en_US.UTF-8
strcoll('$z', '#c') = 23
strcoll('!a', '#c') = -2
!a
#c
$z
Comments welcomed,
- assaf