How to save TStringLists with UTF8
Source
procedure TForm3.Button1Click(Sender: TObject);
var
i: word;
list: tstrings;
begin
list := TStringList.Create;
list.BeginUpdate;
try
for i := 0 to High(word) do
begin
list.Add(format('%d = %s', [i, chr(i)]));
end;
list.EndUpdate;
finally
list.SaveToFile('c:\temp\l.txt', TEncoding.UTF8);
list.free;
end;
end;
procedure TForm3.Button1Click(Sender: TObject);
var
i: word;
list: tstrings;
begin
list := TStringList.Create;
list.BeginUpdate;
try
for i := 0 to High(word) do
begin
list.Add(format('%d = %s', [i, chr(i)]));
end;
list.EndUpdate;
finally
list.SaveToFile('c:\temp\l.txt', TEncoding.UTF8);
list.free;
end;
end;
Comments
Post a Comment