Sample code for 30+ languages & platforms
Delphi ActiveX

HTML Entity Encode and Decode in StringBuilder

Demonstrates HTML encoding and decoding the contents of a StringBuilder.

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
sb: TChilkatStringBuilder;
s: WideString;

begin
sb := TChilkatStringBuilder.Create(Self);

s := '< é ü ç Ω Hello & World ✓ >';
sb.Append(s);

sb.Encode('html','utf-8');
Memo1.Lines.Add(sb.GetAsString());

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

// To decode:
sb.Decode('html','utf-8');
Memo1.Lines.Add(sb.GetAsString());

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