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