How do I set the character set using XMLHttp Object for a POST in classic ASP?

夙愿已清 提交于 2019-12-05 19:57:02

You can set the codepage used by setting the option 'SXH_OPTION_URL_CODEPAGE'

http://msdn.microsoft.com/en-us/library/ms763811(VS.85).aspx

You should also be using the 'MSXML2.ServerXMLHTTP' object not the 'MSXML2.XMLHttp' object which is for single threaded client side apps.

The answer above referring to SXH_OPTION_URL_CODEPAGE is kind of misleading. That option is not related to the encoding of the request body, which I think the question was about.

The problem with the code example in the question is the use of ":" instead of "=" in the header. It should be set as follows:

oXHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded; charset=ISO-8859-1"

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!