[issue23195] Sorting with locale (strxfrm) does not work properly with Python3 on Macos

Ned Deily report at bugs.python.org
Thu Jan 8 23:26:41 CET 2015


Ned Deily added the comment:

The initial difference appears to be a long-standing BSD (including OS X) versus GNU/Linux platform difference.  See, for example:
http://www.postgresql.org/message-id/18C8A481-33A6-4483-8C24-B8CE70DB7F27@eggerapps.at

Why there is no difference between en and fr UTF-8 is obvious when you look under the covers at the system locale definitions.  This is on FreeBSD 10, OS X 10.10 is the same:

$ cd /usr/share/locale/fr_FR.UTF-8/
$ ls -l
total 8
lrwxr-xr-x  1 root  wheel   28 Jan 16  2014 LC_COLLATE -> ../la_LN.US-ASCII/LC_COLLATE
lrwxr-xr-x  1 root  wheel   17 Jan 16  2014 LC_CTYPE -> ../UTF-8/LC_CTYPE
lrwxr-xr-x  1 root  wheel   30 Jan 16  2014 LC_MESSAGES -> ../fr_FR.ISO8859-1/LC_MESSAGES
-r--r--r--  1 root  wheel   36 Jan 16  2014 LC_MONETARY
lrwxr-xr-x  1 root  wheel   29 Jan 16  2014 LC_NUMERIC -> ../fr_FR.ISO8859-1/LC_NUMERIC
-r--r--r--  1 root  wheel  364 Jan 16  2014 LC_TIME

For some reason US-ASCII is used for UTF-8 collation; this is also true for en_US.UTF-8 and de_DE.UTF-8, the only other ones I checked.

The postresq discussion and some earlier Python issues suggest using ICU to properly implement Unicode functions like collation across all platforms.  But that has never been implemented in Python.  Nosing Marc-Andre.

----------
nosy: +lemburg

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23195>
_______________________________________


More information about the Python-bugs-list mailing list