Delphi JSON Encode with TSslHttpCli (Overbyte ICS)

0

I'm using the TSslHttpCli component of Overbyte www.overbyte.eu and am having problems with formatting my json return, with special characters, I'm consuming google's api geolocation, see return:

{
   "results":[
      {
         "address_components":[
            {
               "long_name":"São Paulo",
               "short_name":"São Paulo",
               "types":[
                  "locality",
                  "political"
               ]
            },
            {
               "long_name":"São Paulo",
               "short_name":"São Paulo",
               "types":[
                  "administrative_area_level_2",
                  "political"
               ]
            },
            {
               "long_name":"State of São Paulo",
               "short_name":"SP",
               "types":[
                  "administrative_area_level_1",
                  "political"
               ]
            },
            {
               "long_name":"Brazil",
               "short_name":"BR",
               "types":[
                  "country",
                  "political"
               ]
            }
         ],
         "formatted_address":"São Paulo, State of São Paulo, Brazil",
         "geometry":{
            "bounds":{
               "northeast":{
                  "lat":-23.3566039,
                  "lng":-46.3650844
               },
               "southwest":{
                  "lat":-24.0082209,
                  "lng":-46.825514
               }
            },
            "location":{
               "lat":-23.5505199,
               "lng":-46.63330939999999
            },
            "location_type":"APPROXIMATE",
            "viewport":{
               "northeast":{
                  "lat":-23.3566039,
                  "lng":-46.3650844
               },
               "southwest":{
                  "lat":-24.0082209,
                  "lng":-46.825514
               }
            }
         },
         "place_id":"ChIJ0WGkg4FEzpQRrlsz_whLqZs",
         "types":[
            "locality",
            "political"
         ]
      }
   ],
   "status":"OK"
}

for example the word "SÃ £ o Paulo", I have already changed the encoding, I already changed some settings like "Accept", "AcceptLanguage", "Agent", "ContentType", "ContentEncoding" and nad, does anyone know how to solve? below my HttpCli code ..

HttpCli.Connection      := 'Keep-Alive';
HttpCli.RequestVer      := '1.0';
HttpCli.RcvdStream      := TMemoryStream.Create;;
HttpCli.URL := 'url api...';
HttpCli.Get;

if HttpCli.StatusCode <> 200 then
  begin
   HttpCli.RcvdStream.Free;
   HttpCli.RcvdStream := nil;
   Result := '';
   Exit;
  end;

HttpCli.RcvdStream.Seek(0, 0);
SetLength(Data, HttpCli.RcvdStream.Size);
HttpCli.RcvdStream.Read(Data[1], Length(Data));
xHtmlTemp := String(Data);
    
asked by anonymous 02.06.2018 / 16:45

1 answer

0

is not configuration and properties of the component, just change

xHtmlTemp := String(Data);

by

xHtmlTemp := UTF8Decode(Data);

I wondered why the other component I used did not need this conversion.

    
02.06.2018 / 23:26