You can do it all with TIdURI
:
- To decode use
TIdURI.URLDecode(...)
. - To parse, pass the decoded URI to
TIdURI.Create
.
Putting it together you'd have something like this:
var
URI: TIdURI;
....
URI := TIdURI.Create(TIdURI.URLDecode(EncodedURI));
try
// Protocol = URI.Protocol
// Username = URI.Username
// Password = URI.Password
// Host = URI.Host
// Port = URI.Port
// Path = URI.Path
// Query = URI.Params
finally
URI.Free;
end;
With acknowledgement to these answers: