aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorTollef Fog Heen <tfheen@err.no>2015-11-27 06:42:59 +0100
committerTollef Fog Heen <tfheen@err.no>2015-11-27 06:42:59 +0100
commit84c1abd3f7234e7aef28ada3a65f6e1bc3b1101f (patch)
tree79071911b1ffb051b8a979b761a361ff9fd7048c /wee_slack.py
parentb4e6b1b9c03026731a77d8a6f6c23fdf1d8d6029 (diff)
downloadwee-slack-84c1abd3f7234e7aef28ada3a65f6e1bc3b1101f.tar.gz
Make sure the returned message is utf-8
This prevents a backtrace in the case where you would do "@foo, what's up with a – b"? in a message, i.e, where there was both something to be unfurled as well as a non-ASCII character in the string.
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/wee_slack.py b/wee_slack.py
index 194f8cf..7b7114a 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -1282,6 +1282,8 @@ def process_reply(message_json):
server = servers.find(message_json["_server"])
identifier = message_json["reply_to"]
item = server.message_buffer.pop(identifier)
+ if type(item['text']) is not unicode:
+ item['text'] = item['text'].decode('UTF-8', 'replace')
if "type" in item:
if item["type"] == "message" and "channel" in item.keys():
item["ts"] = message_json["ts"]