Sample code for 30+ languages & platforms
Delphi ActiveX

HTML Encoding

Demonstrates HTML encoding and decoding.

Chilkat Delphi ActiveX Downloads

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

...

procedure TForm1.Button1Click(Sender: TObject);
var
crypt: TChilkatCrypt2;
s: WideString;
htmlEncoded: WideString;

begin
crypt := TChilkatCrypt2.Create(Self);

s := '< é ü ç Ω Hello & World ✓ >';

htmlEncoded := crypt.EncodeString(s,'utf-8','html');
Memo1.Lines.Add(htmlEncoded);

// Output:
// < &eacute; &uuml; &ccedil; &ohm; Hello & World &check; >

// To decode:
s := crypt.DecodeString(htmlEncoded,'utf-8','html');
Memo1.Lines.Add(s);

// Output:
// < é ü ç Ω Hello & World ✓ >
end;