ztfy/utils/unicode.py
changeset 11 89da289790ea
parent 8 455b16a502c4
child 25 7d4d896fd1ce
--- a/ztfy/utils/unicode.py	Thu Aug 13 19:59:05 2009 +0200
+++ b/ztfy/utils/unicode.py	Fri Aug 14 01:02:19 2009 +0200
@@ -82,7 +82,7 @@
 _fillUnicodeTransTable()
 
 
-def translateString(s, escapeSlashes=False, forceLower=True) :
+def translateString(s, escapeSlashes=False, forceLower=True, spaces=' ') :
     """Remove extended characters from string and replace them with 'basic' ones
     
     @param s: text to be cleaned.
@@ -103,6 +103,8 @@
     s = ''.join([a for a in s.translate(_unicodeTransTable) if a.replace(' ','-') in (string.ascii_letters + string.digits + '_-.')])
     if forceLower:
         s = s.lower()
+    if spaces != ' ':
+        s = s.replace(' ', spaces)
     return s