From 434161f9c9ff765a2169af62adf2089582f884a1 Mon Sep 17 00:00:00 2001 From: Ian Paul Date: Tue, 2 Jan 2018 21:56:34 +0200 Subject: [PATCH] This fixes the unicode problem, but now ampersand is printing as unescaped HTML. (#34) --- src/flashbake/plugins/twitter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/flashbake/plugins/twitter.py b/src/flashbake/plugins/twitter.py index 42472d4..2b54f0c 100644 --- a/src/flashbake/plugins/twitter.py +++ b/src/flashbake/plugins/twitter.py @@ -40,6 +40,6 @@ def addcontext(self, message_file, config): public_tweets = api.user_timeline(screen_name = self.username, count = self.tweet_limit, tweet_mode='extended') for tweet in public_tweets: if hasattr(tweet, 'retweeted_status'): - message_file.write('RT @' + tweet.retweeted_status.user.screen_name + ': ' + tweet.retweeted_status.full_text.encode('utf-8') + '\n') + message_file.write(unicode('RT @' + tweet.retweeted_status.user.screen_name + ': ' + tweet.retweeted_status.full_text).encode('utf-8') + '\n') else: - message_file.write('By Me: ' + tweet.full_text.encode('utf-8') + '\n') + message_file.write(unicode('By Me: ' + tweet.full_text).encode('utf-8') + '\n')