Reputation: 99
With Delphi 7 and Indy 9.00.10 I'm using a REST API with JSON. I create a GET request with the TidHTTP component like this.
IdHTTP1.HandleRedirects := True;
IdHTTP1.ReadTimeout := 5000;
IdHTTP1.Request.Accept := 'application/json';
IdHTTP1.Request.AcceptCharSet := 'UTF-8';
IdHTTP1.Request.AcceptLanguage := 'sv';
IdHTTP1.Request.ContentType := 'application/json';
Memo1.Text := IdHTTP1.Get('http://api.arbetsformedlingen.se/af/v0/platsannonser/7088149');
I have tried several charset but can not correct the Swedish characters like å,ä,ö in the response.
What am I doing wrong here?
Upvotes: 2
Views: 3116
Reputation: 21033
In Delphi 7 System
unit there's an UTF8ToAnsi()
function. Use like this:
Memo1.Text := UTF8ToAnsi(IdHTTP1.Get('http://api.arbetsformedlingen.se/af/v0/platsannonser/7088149'));
The result is correct in Delphi 7.
Upvotes: 7