Link to home
Start Free TrialLog in
Avatar of starhu
starhu

asked on

Delphi: THTTPReqResp.Execute -> the returned non English characters are unrecognizable

Hello,

I have a THTTPReqResp object and my problem is that the  returned non English characters are unrecognizable e.g. "L‘rALltsA©g". This is important since I need to parse the Xml and insert the products into database.

I tried UTF8Decode, but it doesn't work:

var
  Msg: TStringStream;
  SoapClient: THTTPReqResp;
  sXmlMsg:TStringStream;

begin

....  here I build the sXmlMsg

  SoapClient:= THTTPReqResp.Create(nil);
  try
    SoapClient.UseUTF8InHeader := True;
    SoapClient.Connect(False);
    SoapClient.URL := 'http://someweburl/server.php';
    SoapClient.InvokeOptions := [soNoValueForEmptySOAPAction];

    SoapClient.Execute(sXmlMsg, Msg);

    Msg.Position := 0;  
    Result := Msg.ReadString(Msg.Size);  // Here the non English characters are unrecognizable
 //   Result := UTF8Decode( Msg.ReadString(Msg.Size) );  // THIS DOESN'T WORK EITHER
  finally

  end;
ASKER CERTIFIED SOLUTION
Avatar of rinfo
rinfo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial