Is it possible to set encoding type for form data of httpx.post? #2786
-
|
I use machine translation Some websites do not use utf-8 (They are too old 😀) , and using utf-8 encoding will cause it to fail to work The way the form is coded seems to be written in the source code? Is there a way to modify the encoding when sending? Line 145 in 6a1841b |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I guess you'd need to send this as pre-encoding bytes, setting the Content-Type header explicitly?... data = {"message1": "测试".encode("gbk")}
content = urlencode(data)
httpx.post(url, content=content, headers={"Content-Type": "application/x-www-form-urlencoded"}) |
Beta Was this translation helpful? Give feedback.
I guess you'd need to send this as pre-encoding bytes, setting the Content-Type header explicitly?...