Make tidy deal with utf8 properly. Oops.
authorMagnus Hagander <magnus@hagander.net>
Sat, 25 Oct 2008 08:14:47 +0000 (08:14 +0000)
committerMagnus Hagander <magnus@hagander.net>
Sat, 25 Oct 2008 08:14:47 +0000 (08:14 +0000)
generator.py

index d4d6e609a0cb93f3c717f3f3444771b5e7007c6d..e12a6954cf2358c8fd4c43391413a0cbeb8dbcf5 100755 (executable)
@@ -28,6 +28,7 @@ class Generator:
                                        output_xhtml=1,
                                        show_body_only=1,
                                        clean=1,
+                                       char_encoding='utf8',
                                        )
                self.items = []
                self.feeds = []
@@ -73,7 +74,7 @@ class Generator:
 
        def TruncateAndCleanDescription(self, txt):
                # First apply Tidy
-               txt = unicode(tidy.parseString(txt.encode('utf-8'), **self.tidyopts))
+               txt = unicode(str(tidy.parseString(txt.encode('utf-8'), **self.tidyopts)),'utf8')
 
                # Then truncate as necessary
                ht = HtmlTruncator(1024)