-
Notifications
You must be signed in to change notification settings - Fork 42
Open
Description
requests文档中有这样一句话
If Response.encoding is None, encoding will be guessed using chardet.
服务器返回的header中没有编码信息( Content-Encoding),导致api函数最后拿到的json是按照 'chardet'编码,导致乱码,解决办法,手动设置编码
r = requests.post(url, headers=headers, data=json.dumps(data))
r.encoding = 'utf8'
r.json()
ronjian, nowbug, the-butterfly and 15926273249
Metadata
Metadata
Assignees
Labels
No labels