From 8eb63214ae0185014b9eabb5413f10eabb9d38bb Mon Sep 17 00:00:00 2001 From: Andre D Date: Fri, 11 Nov 2011 14:02:23 -0500 Subject: [PATCH] Suggest Title decodes html entities --- r2/r2/lib/utils/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/r2/r2/lib/utils/utils.py b/r2/r2/lib/utils/utils.py index 67893c153..b35c4be31 100644 --- a/r2/r2/lib/utils/utils.py +++ b/r2/r2/lib/utils/utils.py @@ -251,7 +251,7 @@ def get_title(url): opener = urlopen(url, timeout=15) text = opener.read(1024) opener.close() - bs = BeautifulSoup(text) + bs = BeautifulSoup(text, convertEntities=BeautifulSoup.HTML_ENTITIES) if not bs: return @@ -260,7 +260,7 @@ def get_title(url): if not title_bs or not title_bs.string: return - return title_bs.string.encode('utf-8') + return title_bs.string.encode('utf-8').strip() except: return None