From aa03d719c31d095d159589b952db9df004923a20 Mon Sep 17 00:00:00 2001 From: Brendan Howell Date: Wed, 3 May 2017 22:10:28 +0200 Subject: [PATCH] cope with unicode in twitter user names --- screenless/bureau/publicrelations/publicrelations.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/screenless/bureau/publicrelations/publicrelations.py b/screenless/bureau/publicrelations/publicrelations.py index d1e635e..30a1145 100644 --- a/screenless/bureau/publicrelations/publicrelations.py +++ b/screenless/bureau/publicrelations/publicrelations.py @@ -95,7 +95,8 @@ class PublicRelations(Bureau): out = "" for t in tweets: prn.set(text_type="U") - prn.text(t["user"]["name"] + "\r\n") + username = t["user"]["name"].encode("cp437", "ignore") + prn.text(username + "\r\n") prn.set(text_type="NORMAL") t_wrapped = textwrap.fill(t["text"], width=48) + "\r\n" t_enc = t_wrapped.encode("cp437", "ignore")