请问怎样解决MSXML2.ServerXMLHTTP的中文字符串传送问题??急急,谢谢!!!(200分)

  • 主题发起人 主题发起人 ywan
  • 开始时间 开始时间
Y

ywan

Unregistered / Unconfirmed
GUEST, unregistred user!
我建立一个WEBSERVICE 方法save(sqlst)写在 aa.asmx 文件中然后在asp页面中调用该WEBSERVICE.代码如下:
Function srSave(sqlStr,asmxURL)
Dim webServiceUrl, httpReq

str=covertion(sqlStr)
webServiceUrl ="http://10.50.0.231/aa.asmx/Save" &
"?strSql=" &
str
Set httpReq = Server.CreateObjec("MSXML2.ServerXMLHTTP") httpReq.Open "GET", webServiceUrl, False
httpReq.Send
consumeWebService=httpReq.responseText

End Function
function covertion(str)
str=replace(str,"%","%25")
str=replace(str,"+","%2B")
str=replace(str," ","+")
str=replace(str,"&", "%26")
str=replace(str,"!", "%EF%BC%81")
str=replace(str,"、", "%E3%80%81")
str=replace(str,"¥", "%EF%BC%81")
str=replace(str,"?", "%EF%BC%9F")
str=replace(str,"……", "%E2%80%A6%E2%80%A6")
str=replace(str,"—", "%E2%80%94")
str=replace(str,"(", "%EF%BC%88")
str=replace(str,")", "%EF%BC%89")
str=replace(str,":", "%EF%BC%9A")
str=replace(str,";", "%EF%BC%9B")
str=replace(str,"“", "%E2%80%9C")
str=replace(str,"”", "%E2%80%9D")
str=replace(str,"〈", "%E3%80%8A")
str=replace(str,"〉", "%E3%80%8B")
str=replace(str,",", "%EF%BC%8C")
str=replace(str,"。", "%E3%80%82")
str=replace(str,"?", "%EF%BC%9F")
str=replace(str,"(","%28")
str=replace(str,")","%29")
str=replace(str,",","%2C")
str=replace(str,"'","%27")
covertion=str
end function
当传送的字符串为中文时,WEBSERVICE 收到的字符串出现乱码(我已将部分符号转换了),请高手不吝赐教!!
 
全角和半角,另外可能跟系统编码有关,查一下吧,应该可以用的
 
在WEB.CONFIG中设定requestencoding和responsencoding皆未gb2312
 
多人接受答案了。
 
后退
顶部