Sample code for 30+ languages & platforms
Delphi DLL

URL Encoding and Decoding

Demonstrates URL encoding/decoding using the HTTP convenience methods.

Chilkat Delphi DLL Downloads

Delphi DLL
uses
    Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
    Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Http;

...

procedure TForm1.Button1Click(Sender: TObject);
var
http: HCkHttp;
s: PWideChar;
encoded: PWideChar;
decoded: PWideChar;

begin
http := CkHttp_Create();

s := 'Hello World! 100% sure.';

encoded := CkHttp__urlEncode(http,s);
Memo1.Lines.Add('URL encoded: ' + encoded);

// Space → %20
// ! → %21
// % → %25

decoded := CkHttp__urlDecode(http,encoded);
Memo1.Lines.Add('URL decoded: ' + decoded);

// Output:

// URL encoded: Hello%20World%21%20100%25%20sure.
// URL decoded: Hello World! 100% sure.

CkHttp_Dispose(http);

end;