stripAccents

This commit is contained in:
j 2010-09-01 14:55:52 +02:00
parent 4a19d5f938
commit 82b7ff413c

View file

@ -2,6 +2,7 @@
# vi:si:et:sw=4:sts=4:ts=4
# GPL 2008
import re
import unicodedata
_articles = ('the', 'la', 'a', 'die', 'der', 'le', 'el',
"l'", 'il', 'das', 'les', 'o', 'ein', 'i', 'un', 'los', 'de',
@ -191,3 +192,8 @@ def normalizePath(path):
if path.endswith('.'): path = path[:-1] + '_'
return path
def stripAccents(s):
if isinstance(s, str):
s = unicode(s)
return ''.join((c for c in unicodedata.normalize('NFD', s) if unicodedata.category(c) != 'Mn'))