读书人

delphi XE5 andriod连接 webservice乱

发布时间: 2013-12-05 22:27:44 作者: rapoo

delphi XE5 andriod连接 webservice乱码问题
andriod客户端在接收webservice传来的数据时是正确的,经测试将值赋值给clientdataset.xmldata的时候,中文数据就成了乱码,找不到原因,请各位大侠指点一下。

procedure TfrmMain.btnSearchClick(Sender: TObject);
var
i,r,iCount: Integer;
ias01: IAndriondServices;
S: String;
begin
ias01 := GetIAndriondServices(True,'http://192.168.1.105:8080/wsdl/IAndriondServices',nil);
S := ias01.GetData('SELECT CODE,NAME,SEX,BIRTHDAY,DEPARTNAME FROM EMPPDI');//此处数据为正确的,没有乱码
ShowMessage(S); //测试没有乱码
cds01.XMLData := S; //赋值完以后就乱码了
S := cds01.XMLData;
ShowMessage(S); //测试出现乱码

with cds01 do
begin
iCount := RecordCount;
if iCount = 0 then
Exit;
r := 0;
for i := 0 to iCount - 1 do
begin
sg01.Cells[0,r] := FieldByName('CODE').AsWideString;
sg01.Cells[1,r] := FieldByName('NAME').AsWideString;
sg01.Cells[2,r] := FieldByName('SEX').AsWideString;
sg01.Cells[3,r] := FieldByName('BIRTHDAY').AsWideString;
sg01.Cells[4,r] := FieldByName('DEPARTNAME').AsWideString;
Inc(r);
Next;
end;
end;
end;
delphi?xe5 webservice 中文乱码
[解决办法]
webservice设置一下XML编码
[解决办法]
引用:
Quote: 引用:

webservice设置一下XML编码
webservice用的是utf-8呀


gb2312 呢
[解决办法]
引用:
Quote: 引用:

Quote: 引用:

webservice设置一下XML编码
webservice用的是utf-8呀


gb2312 呢
貌似不行

读书人网 >.NET

热点推荐