精通
英语
和
开源
,
擅长
开发
与
培训
,
胸怀四海
第一信赖
最近客户遇到如下错误,如下图:
utf-8 codec can't decode byte 0xd9 in position 0:invalid continuation byte接收数据异常,请稍后再试。 utf-8 codec can't decode byte ex88 in position e: invalid start byte 接收数据异常,请稍后再试。utf-8 codec can't decode byte exab in position 1: invalid start byte 请稍后再试。接收数据异常,utf-8 codec can't decode byte 0x9a in position 0: invalid start byte 接收数据异常,请稍后再试。utf-8 codec can't decode byte 0x81 in position 8: invalid start byte 接收数据异常,请稍后再试。utf-8 codec can't decode byte ex84 in position 0: invalid start byte 接收数据异常,请后再试。utf-8 codec can't decode byte xee in position 1: invalid continuation byte 接收数据异常,请稍后再试。utf-8 codec can't decode byte ex8d in position 1: invalid start byte接收数据异常,请稍后再试。 utf-8 codec can't decode byte @xfa in position 1:invalid start byte 接收数据异常,请稍后再试。can't decode byte ex96 in position 2: invalid start byteutf-8"codec接收数据异常,请稍后再试。 utf-8 codec can't decode byte @xcf in position 1: invalid continuation byte 接收数据异常,请稍后再试。utf-8"codeccan't decode byte @xdf in position 0: invalid continuation byte接收数据异常,请稍后再试。 list index out of range 接收数据异常,请稍后再试, can't decode byte exe5 in position 1: imvalid continuation byteutf-8"codec 接收数据异常,请稍后再试,utf-8 codec can't decode byte axge in position 0: invalid start byte 接收数据异常,请稍后再试。utf-8 codec can't decode byte exdf in position 3: invalid continuation byteutf-8"codec 接收数据异常,请稍后再试。utf-8 codec can't decode byte Bxga in position 7: imalid start byte接收数据异常,请稍后再试,
客户说是在多线程操作时出现的。这明显是utf-8解码库遇到了不匹配的字节数组数据,用多线程接收通信数据分析时,出现的问题。utf-8的数据格式要求严格,start byte和continuation byte都有具体要求。
这要多线程互斥保护资源,或者每个线程数据独立就可以解决。
具体代码不会,请找锐英源软件。