]> git.sommitrealweird.co.uk Git - rss2maildir.git/blobdiff - rss2maildir.py
Fix typo in previous charref fix
[rss2maildir.git] / rss2maildir.py
index ff2901c5ffab0414fa563975801c5e6fd76d315f..bbd9b1bb375f97a476d53ac9e9b92f1929cc326e 100755 (executable)
@@ -559,7 +559,16 @@ class HTML2Text(HTMLParser):
         self.curdata = self.curdata + data.decode("utf-8")
 
     def handle_charref(self, name):
-        entity = unichr(int(name))
+        try:
+            entity = unichr(int(name))
+        except:
+            if name[0] == 'x':
+                try:
+                    entity = unichr(int('0%s' %(name,), 16))
+                except:
+                    entity = u'#%s' %(name,)
+            else:
+                entity = u'#%s' %(name,)
         self.curdata = self.curdata + unicode(entity.encode('utf-8'), \
             "utf-8")
 
@@ -674,7 +683,7 @@ def parse_and_deliver(maildir, url, statedir):
         if item.has_key("content"):
             content = item["content"][0]["value"]
         else:
-            content = item["summary"]
+            content = item["description"]
 
         md5sum = md5.md5(content.encode("utf-8")).hexdigest()