From 061da46fb910c60143c66472407e0df79ebebf3b Mon Sep 17 00:00:00 2001 From: spline Date: Mon, 9 Dec 2013 19:57:45 -0500 Subject: [PATCH] Fix \r and \n in tweets that would break formatting. --- plugin.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugin.py b/plugin.py index 65ba81b..782bc48 100644 --- a/plugin.py +++ b/plugin.py @@ -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] == "&#":