procedure WriteU8(const FileName: TFileName; Lines: TStrings); var Writer: TStreamWriter; j: UInt32; begin Writer := TStreamWriter.Create(FileName, False, TEncoding.UTF8); // Encoding try Writer.NewLine := #10; // #13#10-Win, #13-Mac, #10-Nix for j := 0 to Lines.Count-1 do Writer.WriteLine(Lines.Strings[j]); finally FreeAndNil(Writer); end; end;
procedure ReadU8(const FileName: TFileName; OutputTo: TStrings); var Reader: TStreamReader; begin Reader := TStreamReader.Create(FileName, TEncoding.UTF8, False); try while not Reader.EndOfStream do OutputTo.Add( Reader.ReadLine ); finally FreeAndNil(Reader); end; end;