From 707d7abf6debaea196d8ac5f45a8d825bcc0b409 Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Tue, 13 Aug 2013 13:04:27 +0200 Subject: [PATCH] make sure part is encoded string (BeautifulSoup sometimes does not encode input --- util/html.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/util/html.py b/util/html.py index 25cf8f2..a8d9e4e 100644 --- a/util/html.py +++ b/util/html.py @@ -115,4 +115,6 @@ def extractFirstPart(value): else: text = stripAll(value) part = sentencePattern.split(text)[0] + if isinstance(part, unicode): + part = part.encode('UTF-8') return ('

%s

' % part).decode('utf8')