>>> a="\u2026"
>>> a.encode('latin-1')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'latin-1' codec can't encode character '\u2026' in position 0: ordinal not in range(256)
>>> a.encode('utf-8')
b'\xe2\x80\xa6'
问题出在
response = session.post(url, data=payload)
负载包含unicode字符\u2026,无法用“latin-1”编码
示例
当我们用“拉丁语-1”编码“\u2026”时,它不能被编码,但我们可以用“utf-8”编码:可能的修复方法是
。 用'utf-8编码你的有效载荷例如
response = session.post(url, data=payload.encode("utf-8"))
相关问题 更多 >
编程相关推荐