[fpc-devel] TStrings and BOM

Bart bartjunk64 at gmail.com
Thu Jan 2 12:03:11 CET 2020

On Wed, Jan 1, 2020 at 1:00 PM Bart <bartjunk64 at gmail.com> wrote:

Meanwhile, can anybody who has a recent Delphi version comment on this:

> B.t.w. Am I correct in understanding that when TStrings.SaveTo*()
> without an encoding parameter (so, the 1 parameter version) will NOT
> write the BOM if Encoding = nil, whereas the SaveTo* with Encoding
> parameter will write the BOM if Encoding is nil?
> (Assuming that WriteBom=True and DefaultEncoding.GetPreamble returns
> something with Length > 0)

Is this indeed the case in Delphi?
That would mean that if Strings.Encoding is nil and
TStrings.DefaultEncoding is TEncoding.UTF8 then SaveToFile(Fn) would
give a different result then SaveToFile(Fn, TEncoding.Utf8).


More information about the fpc-devel mailing list