Bad mac on the sorting front

Well linux and solaris get it correct, but it looks like the little old mac can’t sort things lexicographically (even when it claims in the manpage that it does).

On Linux/Solaris:

~/x% locale
LANG=en_IE.UTF-8
LC_CTYPE="en_IE.UTF-8"
LC_NUMERIC="en_IE.UTF-8"
LC_TIME="en_IE.UTF-8"
LC_COLLATE="en_IE.UTF-8"
LC_MONETARY="en_IE.UTF-8"
LC_MESSAGES="en_IE.UTF-8"
LC_PAPER="en_IE.UTF-8"
LC_NAME="en_IE.UTF-8"
LC_ADDRESS="en_IE.UTF-8"
LC_TELEPHONE="en_IE.UTF-8"
LC_MEASUREMENT="en_IE.UTF-8"
LC_IDENTIFICATION="en_IE.UTF-8"
LC_ALL=
~/x% ls
a  B  c

On the Mac:

himitsu:~/x% locale
LANG="en_IE.UTF-8"
LC_COLLATE="C"
LC_CTYPE="en_IE.UTF-8"
LC_MESSAGES="en_IE.UTF-8"
LC_MONETARY="en_IE.UTF-8"
LC_NUMERIC="en_IE.UTF-8"
LC_TIME="en_IE.UTF-8"
LC_ALL=
himitsu:~/x% ls
B  a  c

According to the spec:
The following environment variables shall affect the execution of ls …

LC_COLLATE

Determine the locale for character collation information in determining the pathname collation sequence.

Sad little mac does not sort by the locale’s character collation specification (case insensitive, in case you missed it).

One Reply to “Bad mac on the sorting front”

Comments are closed.