A
Adnil
Unregistered / Unconfirmed
GUEST, unregistred user!
使用Microsoft.XMLHTTP调用一个utf-8编码的asp网页,传送一个name参数,asp网页总是只能取到一些乱码,请教有什么办法? (我只能改delphi调用端,asp网页是别人的没办法改)
Delphi代码如下:
procedure TForm1.Button1Click(Sender: TObject);
var
xhttp: Variant;
begin
xhttp := CreateOleObject('Microsoft.XMLHTTP');
xhttp.Open('GET', 'http://localhost/test.asp?name=测试测试', False);
// xhttp.Open('GET', 'http://localhost/test.asp?name=' + urlencode('测试测试'), False); //同样无效
xhttp.Send;
showmessage(xhttp.responseText);
end;
ASP代码如下:
<%@ Language=VBScript Codepage=65001%>
<%
Response.Charset = "utf-8"
name = Request.QueryString("name"
Response.Write name
%>
Delphi代码如下:
procedure TForm1.Button1Click(Sender: TObject);
var
xhttp: Variant;
begin
xhttp := CreateOleObject('Microsoft.XMLHTTP');
xhttp.Open('GET', 'http://localhost/test.asp?name=测试测试', False);
// xhttp.Open('GET', 'http://localhost/test.asp?name=' + urlencode('测试测试'), False); //同样无效
xhttp.Send;
showmessage(xhttp.responseText);
end;
ASP代码如下:
<%@ Language=VBScript Codepage=65001%>
<%
Response.Charset = "utf-8"
name = Request.QueryString("name"
Response.Write name
%>