These are chat archives for IndySockets/Indy

24th
Nov 2015
sandy771
@sandy771
Nov 24 2015 18:18
This message was deleted

I am having a problem with HTTP GET and UTF-8 (Builder XE3 - Indy 10.5.9.0)

I use the following code:

String text = String(u"قفز الثعلب البني السريع فوق الكلب الكسول");
url = "https://www.googleapis.com/language/translate/v2/detect?key=xxxxxxxxxxxxxxx&q=" + text;
url = TIdURI::URLEncode(url);
try
{
IdHTTP1->IOHandler->DefStringEncoding = TIdTextEncoding_UTF8;
IdHTTP1->Request->ContentType = "text/plain; charset=UTF-8";
IdHTTP1->Get(url, strm);
...

When Executed in my application I get an exception - HTTP/1.0 400 Bad Request

If I copy and paste the TIdURI encoded URL (Arabic encoded as hex) into a browser all works OK.

Any ideas?

sandy771
@sandy771
Nov 24 2015 21:26
dont worry thanks sorted