changeset 5546:4f938c4c5084

merged moin/1.7
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Thu, 18 Feb 2010 09:42:25 +0100
parents b1251660d4ee (current diff) 1f638ed400a0 (diff)
children 19cd37af7e99 0ca159b745e8
files MoinMoin/wikiutil.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/wikiutil.py	Sun Feb 14 23:56:27 2010 +0100
+++ b/MoinMoin/wikiutil.py	Thu Feb 18 09:42:25 2010 +0100
@@ -258,7 +258,7 @@
         replace CR, LF, TAB by whitespace
         delete control chars
 
-        @param text: unicode text to clean
+        @param text: unicode text to clean (if we get str, we decode)
         @rtype: unicode
         @return: cleaned text
     """
@@ -267,6 +267,10 @@
     if length == 0 or length > max_len:
         return u''
     else:
+        if isinstance(text, str):
+            # the translate() below can ONLY process unicode, thus, if we get
+            # str, we try to decode it using the usual coding:
+            text = text.decode(config.charset)
         return text.translate(config.clean_input_translation_map)