From 901192ec1805644a214ea56ad68ac383dce13742 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Sat, 18 Oct 2014 19:08:51 -0500 Subject: [PATCH] Handle errors from UnicodeDamnit. --- earwigbot/wiki/copyvios/parsers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/earwigbot/wiki/copyvios/parsers.py b/earwigbot/wiki/copyvios/parsers.py index d3d121b..0cb0a68 100644 --- a/earwigbot/wiki/copyvios/parsers.py +++ b/earwigbot/wiki/copyvios/parsers.py @@ -223,7 +223,8 @@ class _PlainTextParser(_BaseTextParser): def parse(self): """Unicode-ify and strip whitespace from the plain text document.""" - return bs4.UnicodeDammit(self.text).unicode_markup.strip() + converted = bs4.UnicodeDammit(self.text).unicode_markup + return converted.strip() if converted else "" _CONTENT_TYPES = {