--- a/src/ztfy/utils/unicode.py Tue Dec 03 11:43:33 2013 +0100
+++ b/src/ztfy/utils/unicode.py Tue Dec 03 11:45:25 2013 +0100
@@ -82,7 +82,7 @@
_fillUnicodeTransTable()
-def translateString(s, escapeSlashes=False, forceLower=True, spaces=' ') :
+def translateString(s, escapeSlashes=False, forceLower=True, spaces=' ', keep_chars='_-.'):
"""Remove extended characters from string and replace them with 'basic' ones
@param s: text to be cleaned.
@@ -100,7 +100,8 @@
if isinstance(s, str):
s = unicode(s, "utf8", "replace")
s = s.translate(_unicodeTransTable)
- s = ''.join([a for a in s.translate(_unicodeTransTable) if a.replace(' ', '-') in (string.ascii_letters + string.digits + '_-.')])
+ s = ''.join([a for a in s.translate(_unicodeTransTable)
+ if a.replace(' ', '-') in (string.ascii_letters + string.digits + (keep_chars or ''))])
if forceLower:
s = s.lower()
if spaces != ' ':