I'm using wp_remote_post()
on a project and it works great. But seems like the server on which I need to make the POST request is a Windows (ISS) server. So the third-party service that provides this specific endpoint requires that all POST requests has a Windows-1252 character encoding, otherwise there will be issues with special characters (like á, é, û, etc).
I did some research and seems like the way to go is to set a Content-Type
HTTP header which includes a charset (like charset=Windows-1252
). Tried to add the charset along with the content type (like application/x-www-form-urlencoded;charset=Windows-1252
), but nothing seems to work.
Does anyone know how to proper set the charset for an HTTP POST request using wp_remote_post()
?
Thanks in advance!
=
, so you could tryapplication/x-www-form-urlencoded;charset=Windows-1252
Content-Type
is a response field, not a request field. I thought it was also valid as a request field? There we see e.g. theAccept-Charset
request field, but I'm don't think that's what you need. Have you tried encoding the POST data manually ?Content-Type
is also a request field. And to define the charset, it seems that this is the correct approach: w3.org/International/articles/http-charset/index.en