Fix \r and \n in tweets that would break formatting.

This commit is contained in:
spline 2013-12-09 19:57:45 -05:00
parent f96245c677
commit 061da46fb9
1 changed files with 3 additions and 1 deletions

View File

@ -150,7 +150,9 @@ class Tweety(callbacks.Plugin):
def _unescape(self, text):
"""Created by Fredrik Lundh (http://effbot.org/zone/re-sub.htm#unescape-html)"""
text = text.replace('\n', ' ')
# quick dump \n and \r, usually coming from bots that autopost html.
text = text.replace('\n', ' ').replace('\r', ' ')
# now the actual unescape.
def fixup(m):
text = m.group(0)
if text[:2] == "&#":