var jsonToSend:TStringList;
begin
IdHTTP1.HandleRedirects := true;
IdHTTP1.ReadTimeout := 12000;
IdHTTP1.Request.Accept := 'text/xml';
IdHTTP1.Request.ContentType := 'text/xml';
IdHTTP1.Request.ContentEncoding := 'utf-8';
jsonToSend:=TStringList.create;
try
jsonToSend.Add('inputXml=<Result>'
'<StoreName>view & name</StoreName>'
'</Result>');
Memo1.Lines.Text:=IdHTTP1.Post('http://localhost:8080/SAy/register', jsonToSend);
finally
FreeAndNil(jsonToSend);
end;
end;
end.
傳輸一段字串的時候,如果字串里包含有&字符,那么接收端就只能接收&前面的那一串
“<Result>''<StoreName>view”, &后面的資料丟失了
對&進行轉義了,用的 & 可結果還是一樣
也用 <![CDATA[ ]]>試過了,沒有用
求指導 求幫助, 有特殊字符的時候傳輸應該怎么處理
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/104488.html
標籤:非技術區
