Stop trying to decode image tags to utf-8
[rss2maildir.git] / rss2maildir.py
index b4acdec086d924bb9175c51dca551caf9ab07913..dc0427a6d2e8ac9ee5a206a89ce5f0634364a3f8 100755 (executable)
@@ -307,9 +307,9 @@ class HTML2Text(HTMLParser):
         url = u''
         for attr in attrs:
             if attr[0] == 'alt':
-                alt = attr[1].decode('utf-8')
+                alt = attr[1]
             elif attr[0] == 'src':
-                url = attr[1].decode('utf-8')
+                url = attr[1]
         if url:
             if alt:
                 if self.images.has_key(alt):
@@ -741,8 +741,8 @@ def parse_and_deliver(maildir, url, statedir):
                 ]) + "@" + socket.gethostname() + ">"
         msg.add_header("Message-ID", messageid)
         msg.set_unixfrom("\"%s\" <rss2maildir@localhost>" %(url))
-        msg.add_header("From", "\"%s\" <rss2maildir@localhost>" %(author))
-        msg.add_header("To", "\"%s\" <rss2maildir@localhost>" %(url))
+        msg.add_header("From", "\"%s\" <rss2maildir@localhost>" %(author.encode("utf-8")))
+        msg.add_header("To", "\"%s\" <rss2maildir@localhost>" %(url.encode("utf-8")))
         if prevmessageid:
             msg.add_header("References", prevmessageid)
         createddate = datetime.datetime.now() \