Fix HtmlSanitizer to return cleaned string in proper encoding.
authorPawel Solyga <Pawel.Solyga@gmail.com>
Mon, 06 Jul 2009 00:54:48 +0200
changeset 2555 b7f14c803619
parent 2554 e32452672666
child 2556 d1175010235e
Fix HtmlSanitizer to return cleaned string in proper encoding. This fix prevent HtmlSanitizer from throwing UnicodeDecodeError exception.
app/htmlsanitizer/HtmlSanitizer.py
--- a/app/htmlsanitizer/HtmlSanitizer.py	Mon Jul 06 00:31:48 2009 +0200
+++ b/app/htmlsanitizer/HtmlSanitizer.py	Mon Jul 06 00:54:48 2009 +0200
@@ -203,7 +203,7 @@
         if len(string) and self.settings['auto_clean'] : self.clean()
         
     def get_string(self):
-        return unicode(self.root.renderContents())
+        return self.root.renderContents().decode('utf-8')
     
     string = property(get_string, set_string)