From: Brett Parker Date: Wed, 5 Mar 2008 10:05:16 +0000 (+0000) Subject: Fix for title parsing X-Git-Url: https://git.sommitrealweird.co.uk/rss2maildir.git/commitdiff_plain/478a1d0d963fbcd839f2fe42662dfbad6967705c?ds=sidebyside;hp=9337881574f8f9370fecabfeb9a52e4341568cd9 Fix for title parsing --- diff --git a/rss2maildir.py b/rss2maildir.py index 9473dd0..ff2901c 100755 --- a/rss2maildir.py +++ b/rss2maildir.py @@ -44,6 +44,8 @@ import md5 import cgi import dbm +import re + from HTMLParser import HTMLParser class HTML2Text(HTMLParser): @@ -725,7 +727,10 @@ def parse_and_deliver(maildir, url, statedir): pass msg.add_header("Date", createddate) subj_gen = HTML2Text() - subj_gen.feed(item["title"].encode("utf-8")) + title = item["title"].encode("utf-8") + title = re.sub(u'<', u'<', title) + title = re.sub(u'>', u'>', title) + subj_gen.feed(title) msg.add_header("Subject", subj_gen.gettext()) msg.set_default_type("text/plain")