From 73160e0faf5ee7221a1acc6ba97bce06e2963dec Mon Sep 17 00:00:00 2001 From: Samuel Clay Date: Wed, 11 May 2016 13:28:48 -0700 Subject: [PATCH] Properly decoding text/plain. --- utils/story_functions.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/utils/story_functions.py b/utils/story_functions.py index 84fde8f75..a329c18c5 100644 --- a/utils/story_functions.py +++ b/utils/story_functions.py @@ -113,6 +113,8 @@ def pre_process_story(entry, encoding): if 'summary_detail' in entry and entry['summary_detail'].get('type', None) == 'text/plain': entry['story_content'] = feedparser._sanitizeHTML(entry['story_content'], encoding, 'text/plain') + if encoding and not isinstance(entry['story_content'], unicode): + entry['story_content'] = entry['story_content'].decode(encoding, 'ignore') # Add each media enclosure as a Download link for media_content in chain(entry.get('media_content', [])[:5], entry.get('links', [])[:5]):