From: Benjamin Mako Hill Date: Sat, 25 Apr 2015 18:19:36 +0000 (-0700) Subject: Merge branch 'master' of github.com:guyrt/twitter-data-examples X-Git-Url: https://projects.mako.cc/source/twitter-api-cdsw-solutions/commitdiff_plain/90a7a18fb765fb79af12bf4e694573fef9fd653a?hp=b5d973d7a0a14eca21b2981ffacf4fb9ea77ba41 Merge branch 'master' of github.com:guyrt/twitter-data-examples --- diff --git a/tweepy/models.py b/tweepy/models.py index 09ed3eb..af80986 100644 --- a/tweepy/models.py +++ b/tweepy/models.py @@ -77,8 +77,10 @@ class Status(Model): status = cls(api) # I'm not proud. Blame billg. - json['text'] = str(json['text'].encode('ascii', 'ignore'))[2:-1] - json['user']['screen_name'] = str(json['user']['screen_name'].encode('ascii', 'ignore'))[2:-1] + import sys + json['text'] = str(json['text'].encode(sys.stdout.encoding, 'replace'))[2:-1] + if 'user' in json: + json['user']['screen_name'] = str(json['user']['screen_name'].encode(sys.stdout.encoding, 'replace'))[2:-1] setattr(status, '_json', json) for k, v in json.items():