I've got a problem with sorting lists using unicode collation in Python 2.5.1 and 2.6.5 on OSX, as well as on Linux.
import locale
locale.setlocale(locale.LC_ALL, 'pl_PL.UTF-8')
print [i for i in sorted([u'a', u'z', u'?'], cmp=locale.strcoll)]
Which should print:
[u'a', u'?', u'z']
But instead prints out:
[u'a', u'z', u'?']
Summing it up - it looks as if strcoll was broken. Tried it with various types of variables (fe. non-unicode encoded strings).
What do I do wrong?
Best regards,
Tomasz Kopczuk.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…