]> git.sommitrealweird.co.uk Git - rss2maildir.git/blobdiff - rss2maildir.py
More utf-8 handling for images
[rss2maildir.git] / rss2maildir.py
index 8a59c8548761e87c06c1befe66a9f3550cf4b07b..a9abe4d1496cb676ffe4e3efe41d623431835dbe 100755 (executable)
@@ -307,9 +307,15 @@ class HTML2Text(HTMLParser):
         url = u''
         for attr in attrs:
             if attr[0] == 'alt':
         url = u''
         for attr in attrs:
             if attr[0] == 'alt':
-                alt = attr[1].decode('utf-8')
+                if isinstance(attr[1], str):
+                    alt = u'%s' %(attr[1].decode("utf-8"))
+                else:
+                    alt = attr[1]
             elif attr[0] == 'src':
             elif attr[0] == 'src':
-                url = attr[1].decode('utf-8')
+                if isinstance(attr[1], str):
+                    url = u'%s' %(attr[1].decode("utf-8"))
+                else:
+                    url = attr[1]
         if url:
             if alt:
                 if self.images.has_key(alt):
         if url:
             if alt:
                 if self.images.has_key(alt):