stripAccents
This commit is contained in:
parent
4a19d5f938
commit
82b7ff413c
1 changed files with 6 additions and 0 deletions
|
@ -2,6 +2,7 @@
|
||||||
# vi:si:et:sw=4:sts=4:ts=4
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
# GPL 2008
|
# GPL 2008
|
||||||
import re
|
import re
|
||||||
|
import unicodedata
|
||||||
|
|
||||||
_articles = ('the', 'la', 'a', 'die', 'der', 'le', 'el',
|
_articles = ('the', 'la', 'a', 'die', 'der', 'le', 'el',
|
||||||
"l'", 'il', 'das', 'les', 'o', 'ein', 'i', 'un', 'los', 'de',
|
"l'", 'il', 'das', 'les', 'o', 'ein', 'i', 'un', 'los', 'de',
|
||||||
|
@ -191,3 +192,8 @@ def normalizePath(path):
|
||||||
if path.endswith('.'): path = path[:-1] + '_'
|
if path.endswith('.'): path = path[:-1] + '_'
|
||||||
return path
|
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'))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue