diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2015-10-18 14:52:49 +0200 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2015-10-18 22:28:36 +0200 |
commit | 5eb0a19aeec23324ccc3a245613eab0a48f5d398 (patch) | |
tree | 60f25c41bbf7840c7ede681a63b086d909e8d014 /wee_slack.py | |
parent | 2d50c4e59ae603706840ea42ec1e718c62232458 (diff) | |
download | wee-slack-5eb0a19aeec23324ccc3a245613eab0a48f5d398.tar.gz |
Only decode messages if they are not already unicode
Some messages are already of type unicode when sent into buffer_prnt.
This makes message.decode fail with the following error:
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe5' in
position 76: ordinal not in range(128)
Diffstat (limited to 'wee_slack.py')
-rw-r--r-- | wee_slack.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/wee_slack.py b/wee_slack.py index db4b178..e222966 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -584,7 +584,8 @@ class Channel(object): name = name.decode('utf-8') #colorize nicks in each line chat_color = w.config_string(w.config_get('weechat.color.chat')) - message = message.decode('UTF-8', 'replace') + if type(message) is not unicode: + message = message.decode('UTF-8', 'replace') for user in self.server.users: if user.name in message: message = user.name_regex.sub( |