]> git.sommitrealweird.co.uk Git - rss2maildir.git/commitdiff
Fix for title parsing
authorBrett Parker <iDunno@sommitrealweird.co.uk>
Wed, 5 Mar 2008 10:05:16 +0000 (10:05 +0000)
committerBrett Parker <iDunno@sommitrealweird.co.uk>
Wed, 5 Mar 2008 10:05:16 +0000 (10:05 +0000)
rss2maildir.py

index 9473dd009e3d5ebead31933d7ba110abd4202162..ff2901c5ffab0414fa563975801c5e6fd76d315f 100755 (executable)
@@ -44,6 +44,8 @@ import md5
 import cgi
 import dbm
 
 import cgi
 import dbm
 
+import re
+
 from HTMLParser import HTMLParser
 
 class HTML2Text(HTMLParser):
 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()
             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'&lt;', title)
+        title = re.sub(u'>', u'&gt;', title)
+        subj_gen.feed(title)
         msg.add_header("Subject", subj_gen.gettext())
         msg.set_default_type("text/plain")
 
         msg.add_header("Subject", subj_gen.gettext())
         msg.set_default_type("text/plain")