cope with unicode in twitter user names

workspace
Brendan Howell 8 years ago
parent 87546aa7a4
commit aa03d719c3

@ -95,7 +95,8 @@ class PublicRelations(Bureau):
out = "" out = ""
for t in tweets: for t in tweets:
prn.set(text_type="U") 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") prn.set(text_type="NORMAL")
t_wrapped = textwrap.fill(t["text"], width=48) + "\r\n" t_wrapped = textwrap.fill(t["text"], width=48) + "\r\n"
t_enc = t_wrapped.encode("cp437", "ignore") t_enc = t_wrapped.encode("cp437", "ignore")

Loading…
Cancel
Save