UnicodeDecodeError: 'utf8' codec can't decode byte 0x9c

前端 未结 10 2114
暖寄归人
暖寄归人 2020-11-22 14:49

I have a socket server that is supposed to receive UTF-8 valid characters from clients.

The problem is some clients (mainly hackers) are sending all the wrong kind of

10条回答
  •  生来不讨喜
    2020-11-22 15:08

    I had same problem with UnicodeDecodeError and i solved it with this line. Don't know if is the best way but it worked for me.

    str = str.decode('unicode_escape').encode('utf-8')
    

提交回复
热议问题