请求返回字节且无法转换为字符串

时间:2018-10-31 07:02:46

标签: request python-3.5

对于以下响应b'PK \ x03 \ x04 \ x14 \ x00 \ x06 \ x00 \ x08 \ x00 \ x00 \ x00!\ x00 $ \ xecP \ xbf \ x82 \ x01 \ x00 \ x00 $ \ x07 \ x00 \ x00 \ x13 \ x00 \ x08 \ x02 [Content_Types] .xml

该请求正在返回字节,并且在使用s = response.content.decode("utf-8")进行转换时,它给出了一条错误消息:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xec in position 15: invalid continuation byte

我尝试了多种转换方式,例如
s = response.content.decode("ISO-8859-1")
但这不是可读格式

s = response.content.decode('latin-1')

但这也不是可读格式

将字节转换为变量中带有'0xec'字符的字符串还有哪些其他方法?

0 个答案:

没有答案
相关问题