Hi,
if I enter the following url in my browser, I get a result file with the name "Müller" translated to russian characters:
https://translate.googleapis.com/translate_a/single?client=gtx&sl=de&tl=ru&dt=t&q=Müller
I tried to implement that with TIdHTTP, but something is missing and I don't find the problem. Here is my code:
var
data : String;
http : TIdHTTP;
sslIO : TIdSSLIOHandlerSocketOpenSSL;
tmp : TStringStream;
url : String;
begin
http := TIdHTTP.Create(nil);
http.HTTPOptions := http.HTTPOptions + [hoNoProtocolErrorException, hoWantProtocolErrorContent];
sslIO := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
sslIO.SSLOptions.SSLVersions := [sslvTLSv1, sslvTLSv1_1, sslvTLSv1_2];
sslIO.SSLOptions.Mode := sslmUnassigned;
sslIO.SSLOptions.VerifyMode := [];
sslIO.SSLOptions.VerifyDepth := 0;
http.IOHandler := sslIO;
url := TIdUri.UrlEncode('https://translate.googleapis.com/translate_a/single?client=gtx&sl=de&tl=ru&dt=t&q=Müller');
tmp := TStringStream.Create;
http.Get(url, tmp);
data := tmp.DataString;
tmp.Free;
http.Free;
end;
I expect to get the following string (like in the browser):
[[["мельник","Müller",null,null,0]],null,"de"]
Can somebody tell me what is wrong in my code?
Christian