X-Git-Url: https://git.sommitrealweird.co.uk/rss2maildir.git/blobdiff_plain/478a1d0d963fbcd839f2fe42662dfbad6967705c..88b4ead7d0ce70bb35bc27a49225bfca23354185:/rss2maildir.py?ds=sidebyside diff --git a/rss2maildir.py b/rss2maildir.py index ff2901c..b77c6d7 100755 --- a/rss2maildir.py +++ b/rss2maildir.py @@ -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,10 @@ def parse_and_deliver(maildir, url, statedir): if item.has_key("content"): content = item["content"][0]["value"] else: - content = item["summary"] + if item.has_key("description"): + content = item["description"] + else: + content = u'' md5sum = md5.md5(content.encode("utf-8")).hexdigest()