diff MoinMoin/wikiutil.py @ 175:df4fe62dc160

fixing eventlog UnicodeDecodeError, try2 imported from: moin--main--1.5--patch-177
author Thomas Waldmann <tw@waldmann-edv.de>
date Mon, 31 Oct 2005 18:58:37 +0000
parents 11740ebb136c
children 722b8f648630
line wrap: on
line diff
--- a/MoinMoin/wikiutil.py	Mon Oct 31 18:37:33 2005 +0000
+++ b/MoinMoin/wikiutil.py	Mon Oct 31 18:58:37 2005 +0000
@@ -154,7 +154,7 @@
         s = s.decode(config.charset)
     return s
 
-def parseQueryString(qstr, want_unicode=False):
+def parseQueryString(qstr, want_unicode=True):
     """ Parse a querystring "key=value&..." into a dict.
     """
     is_unicode = isinstance(qstr, unicode)
@@ -165,7 +165,10 @@
         if len(value) < 2:
             v = ''.join(value)
             if want_unicode:
-                v = v.decode(config.charset)
+                try:
+                    v = unicode(v, config.charset)
+                except UnicodeDecodeError:
+                    v = unicode(v, 'iso-8859-1', 'replace')
             values[key] = v
     return values