leporo / tornado-redis

Asynchronous Redis client that works within Tornado IO loop.
666 stars 162 forks source link

SockJSSubscriber raise 'UnicodeEncodeError' Exception #63

Open cloverstd opened 10 years ago

cloverstd commented 10 years ago

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.

leporo commented 10 years ago

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

cloverstd commented 10 years ago

@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'.

leporo commented 10 years ago

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