X-Git-Url: https://projects.mako.cc/source/twitter-api-cdsw/blobdiff_plain/043b63c67557591f1e85b53d17fc8a1a797f48ca..d157b6236fb8b3fc3fb51c38f2bcb235b22ccd8c:/tweepy/models.py 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():