=== modified file 'xl/common.py' --- xl/common.py 2009-07-28 14:50:56 +0000 +++ xl/common.py 2009-07-29 20:06:59 +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 _ @@ -323,6 +323,18 @@ ret = the_cutter(ret) 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-07-28 15:04:53 +0000 +++ xl/trackdb.py 2009-07-29 20:06:21 +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-07-28 23:12:03 +0000 +++ xlgui/panel/collection.py 2009-07-29 20:04:57 +0000 @@ -543,10 +543,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(v) + char = common.strip_marks(check_val.lower()[0]) if char.isdigit(): char = '0'