Skip to content
This repository was archived by the owner on Aug 15, 2022. It is now read-only.

support utf-8 encode#9

Closed
ChihChengLiang wants to merge 1 commit intoslack-samples:masterfrom
ChihChengLiang:utf8-support
Closed

support utf-8 encode#9
ChihChengLiang wants to merge 1 commit intoslack-samples:masterfrom
ChihChengLiang:utf8-support

Conversation

@ChihChengLiang
Copy link

don't crash when dealing with utf8 message.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix:
message = output[1]
channel.send_message("{}".format(message).decode('utf-8'))

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think messagemessage = output[1].encode('utf-8', 'ignore') could be better.

@logi85
Copy link

logi85 commented May 18, 2016

would be great if merged.

But only works, if rtmbot.py is changed at beginning:

import sys
sys.dont_write_bytecode = True
+reload(sys)
+sys.setdefaultencoding('utf8')

@yyar
Copy link

yyar commented Jun 4, 2016

+1
But in master branch, this code is moved to rtmbot/core.py. So I think modify this position which is
https://github.com/slackhq/python-rtmbot/blob/master/rtmbot/core.py#L104.

@jammons
Copy link
Contributor

jammons commented Jun 5, 2016

Turns out this was somewhat complicated to make it work in both py2.7 and py3.5. I think I have a solution in #46. Feel free to give it a look and add comments if you'd like.

@jammons jammons closed this Jun 5, 2016
@ChihChengLiang ChihChengLiang deleted the utf8-support branch June 6, 2016 08:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants