tornado-redis icon indicating copy to clipboard operation
tornado-redis copied to clipboard

SockJSSubscriber raise 'UnicodeEncodeError' Exception

Open cloverstd opened this issue 10 years ago • 3 comments

Hi, I am writing a realtime web application with SockJSSubscriber. When I send a unicode string that exceed ASCII's coding range, like Chinese character, there will raise UnicodeEncodeError Exception on 'tornadoredis/pubsub.py", line 146, in on_message'.

[Solutions] I inherit a SockJSSubscriber and overwrite the on_message to encode the msg.body to str, and it work well.

cloverstd avatar Apr 26 '14 09:04 cloverstd

Please clarify: have you removed the str() type casting/encoding from the line 146?

leporo avatar Apr 27 '14 11:04 leporo

@leporo No, I have not modified the source of tornado-redis. You can test a Chinese charater like u"你好"(means hello) or u'\u4f60\u597d'.

cloverstd avatar Apr 28 '14 14:04 cloverstd

Could you please try the current master branch? Does it work for you?

leporo avatar Apr 28 '14 14:04 leporo