Sample code for 30+ languages & platforms
Delphi ActiveX

Load utf-8 Text File into a StringBuilder

Demonstrates how to load a utf-8 text file into a StringBuilder object instance.

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
success: Integer;
sb: TChilkatStringBuilder;

begin
success := 0;

sb := TChilkatStringBuilder.Create(Self);

success := sb.LoadFile('someFileContainingUtf8.txt','utf-8');
if (success <> 1) then
  begin
    Memo1.Lines.Add('Failed.');
  end
else
  begin
    Memo1.Lines.Add('Success.');
  end;
end;