Python: UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0: invalid start byte

后端 未结 3 573
梦如初夏
梦如初夏 2021-01-15 04:11

I am fetching data from a catalog and it\'s giving data in bytes format.

Bytes data:

b\'\\x80\\x00\\x00\\x00\\n\\x00\\x00%\\x83\\xa0\\x08\\x01\\x00\\         


        
3条回答
  •  一向
    一向 (楼主)
    2021-01-15 04:30

    You can try ignoring the non-readable blocks.

    blobs.decode('utf-8', 'ignore')

    It's not a great solution but the way you're generating the byte object has some issues. Maybe, utf-8 is not the proper encoding for your data.

提交回复
热议问题