Skip to content
Permalink
Browse files

Issue #140: Prefer TStreamWriter over TFileStream, in SaveUnicodeFile…

…(). Also, use its own Write() method instead of StreamWrite(), which encodes UTF8 first, so the new approach is probably faster. Probably also helps with non-writable tab backups on some systems.
  • Loading branch information...
ansgarbecker committed Oct 13, 2019
1 parent 1d94724 commit 10f61069c82975016c3a4ed76191925aaa4e1435
Showing with 4 additions and 4 deletions.
  1. +4 −4 source/apphelpers.pas
@@ -1118,11 +1118,11 @@ function GetTempDir: String;
}
procedure SaveUnicodeFile(Filename: String; Text: String);
var
f: TFileStream;
Writer: TStreamWriter;
begin
f := TFileStream.Create(Filename, fmCreate or fmOpenWrite);
StreamWrite(f, Text);
f.Free;
Writer := TStreamWriter.Create(Filename, False, TEncoding.UTF8);
Writer.Write(Text);
Writer.Free;
end;


0 comments on commit 10f6106

Please sign in to comment.
You can’t perform that action at this time.