Fixing small text importer bug with missing encodings.

This commit is contained in:
Samuel Clay 2013-07-13 14:22:23 -07:00
parent 78b3ffe7db
commit 1fc3e05b89

View file

@ -25,7 +25,7 @@ class TextImporter:
def fetch(self, skip_save=False):
html = requests.get(self.story.story_permalink, headers=self.headers, verify=False)
text = html.text
if html.encoding != 'utf-8':
if html.encoding and html.encoding != 'utf-8':
text = text.encode(html.encoding)
original_text_doc = readability.Document(text, url=html.url, debug=settings.DEBUG)
content = original_text_doc.summary(html_partial=True)