WebCore base64 encoding

With Delphi 10.4.1 VCL, base64 encoding can be achieved this way

In WebCore, uses System.NetEncoding; cannot be found

Can you tell me how to do it?


// Delphi 10.4.1
// WebCore15.6.0
{$R *.dfm}

uses System.NetEncoding;

procedure TForm1.WebButton1Click(Sender: TObject);
var
s, sEncod: string;
Base64: TBase64Encoding;
begin
s := WebEdit1.Text;
Base64 := TBase64Encoding.Create(10, '');
sEncod := Base64.Encode(s);
WebEdit2.Text:=sEncod;
end;

procedure TForm1.WebButton2Click(Sender: TObject);
var
s, sDecod: string;
Base64: TBase64Encoding;
begin
s := WebEdit2.Text;
Base64 := TBase64Encoding.Create(10, '');
sDecod := Base64.Decode(s);
WebEdit1.Text:=sDecod;
end;

Sample code

Base64_4_VCL.zip (36.3 KB)

Base64_4_Web.zip (9.9 KB)

In the browser, this is done with atob() and btoa()


these functions are declared in web.pas

Thank you Bruno
I was able to execute it.