jrief / django-websocket-redis

Websockets for Django applications using Redis as message queue
http://django-websocket-redis.awesto.com/
MIT License
894 stars 221 forks source link

validation error in the line containing non-English characters #216

Open kmakeev opened 7 years ago

kmakeev commented 7 years ago

utf8validator.py", line 129, in validate self.state = Utf8Validator.UTF8VALIDATOR_DFA[256 + (self.state << 4) + Utf8Validator.UTF8VALIDATOR_DFA[ord(ba[i])]] IndexError: list index out of range

Example: ba = {"string":"а"}

romabiker commented 5 years ago

I also ancounted such error when sending russian letters through websocket. After observing utf8validator.py I found that by default Utf8Validator of pure Python implementation is used and there is import of Cython implementation of UTF8 validator if available. Which is not installed by default. To fix this we have to install additionally https://pypi.org/project/wsaccel/

try:
    from wsaccel.utf8validator import Utf8Validator
except:
     ## fallback to pure Python implementation
     class Utf8Validator: