I am new to HTTP. I have several HTTP GETs which return text encoded in either ANSI or UTF-8. Is there a way to determine which is returned so that I can handle the conversion in the method rather than doing trials and hard coding the necessary conversions for each? or if it can be handled by Indy itself?
Here's what I use to GET:
Main Method
procedure TIdHTTPHelper.SendGet
( const AURL : String;
var AResponse: TMemoryStream );
begin
Request.ContentType := '';
Request.ContentLength := -1;
Get ( AURL, AResponse );
AResponse.Position := 0;
end;
Overloaded Method For Strings
procedure TIdHTTPHelper.SendGet
( const AURL : String;
var AResponse: String);
var
Response : TMemoryStream;
begin
Response := TMemoryStream.Create;
SendGet ( AURL, Response );
SetLength ( AResponse, Response.Size div 2 );
Response.Read ( AResponse [1], Response.Size );
Response.Free;
end;