Sample code for 30+ languages & platforms
Delphi DLL

Load utf-8 Text File into a StringBuilder

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

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, StringBuilder;

...

procedure TForm1.Button1Click(Sender: TObject);
var
success: Boolean;
sb: HCkStringBuilder;

begin
success := False;

sb := CkStringBuilder_Create();

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

CkStringBuilder_Dispose(sb);

end;