=== modified file 'xl/common.py' --- xl/common.py 2009-08-03 14:26:42 +0000 +++ xl/common.py 2009-08-24 18:03:24 +0000 @@ -14,7 +14,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -import locale, logging, os, random, re, string, threading, time, traceback, \ +import unicodedata, locale, logging, os, random, re, string, threading, time, traceback, \ urllib, urlparse from functools import wraps from xl.nls import gettext as _ @@ -324,6 +324,18 @@ return ret +def normalize(field): + """ + Normalizes a utf8 string into a fully developed form + """ + return unicodedata.normalize('NFD', field) + +def strip_marks(field): + """ + Removes non spacing marks from a string (that is accents, mainly) + """ + return ''.join((c for c in normalize(field) if unicodedata.category(c) != 'Mn')) + class VersionError(Exception): """ Represents version discrepancies === modified file 'xl/trackdb.py' --- xl/trackdb.py 2009-08-23 21:55:23 +0000 +++ xl/trackdb.py 2009-08-24 18:03:24 +0000 @@ -26,6 +26,7 @@ from xl.nls import gettext as _ from xl import common, track, event, xdg +import locale try: import cPickle as pickle @@ -54,7 +55,7 @@ """ def lower(x): if type(x) == type(""): - return x.lower() + return locale.strxfrm(x) return x items = [] if not type(fields) in (list, tuple): @@ -283,12 +284,10 @@ is primarily useful for the collection panel """ def the_cmp(x, y): - if isinstance(x, basestring): - x = x.lower() + if isinstance(x, basestring) and isinstance(y, basestring): x = common.the_cutter(x) - if isinstance(y, basestring): - y = y.lower() y = common.the_cutter(y) + return locale.strcoll(x,y) return cmp(x, y) if sort_by == []: === modified file 'xlgui/panel/collection.py' --- xlgui/panel/collection.py 2009-08-22 19:36:07 +0000 +++ xlgui/panel/collection.py 2009-08-24 19:37:56 +0000 @@ -595,10 +595,8 @@ v = _("Unknown") if depth == 0 and draw_seps: - check_val = v - if check_val.lower().startswith('the '): - check_val = check_val[4:] - char = check_val.lower()[0] + check_val = common.the_cutter(common.lstrip_special(v)) + char = common.strip_marks(check_val.lower()[0]) if char.isdigit(): char = '0'