]> git.sommitrealweird.co.uk Git - rss2maildir.git/commitdiff
* Small Unicode fix for img tags.
authorBrett Parker <iDunno@sommitrealweird.co.uk>
Sun, 13 Jan 2008 16:12:16 +0000 (16:12 +0000)
committerBrett Parker <iDunno@sommitrealweird.co.uk>
Sun, 13 Jan 2008 16:12:16 +0000 (16:12 +0000)
rss2maildir.py

index 910b8a913cf64ef9bc714cb2eefd72c28179a1ec..113d931a1db7bf162f603ce1cc646137a1f97b9c 100755 (executable)
@@ -180,21 +180,17 @@ class HTML2Text(HTMLParser):
         url = u''
         for attr in attrs:
             if attr[0] == 'alt':
-                alt = attr[1]
+                alt = attr[1].decode('utf-8')
             elif attr[0] == 'src':
-                url = attr[1]
+                url = attr[1].decode('utf-8')
         if url:
             self.curdata = self.curdata \
                 + u' [img:' \
-                + unicode( \
-                    url.encode('utf-8'), \
-                    'utf-8')
+                + url
             if alt:
                 self.curdata = self.curdata \
                     + u'(' \
-                    + unicode( \
-                        alt.encode('utf-8'), \
-                        'utf-8') \
+                    + alt \
                     + u')'
             self.curdata = self.curdata \
                 + u']'