On Wed, Jan 1, 2020 at 12:25 PM Bart <bartjun...@gmail.com> wrote:

> > By all means, patches welcome.

Patch attached.
For completeness I could implement also SaveToStream(AStream,
AWriteBom) and SaveToFile(FileName, AWriteBom).

B.t.w. Am I correct in understanding that when TStrinsg.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)

It feels a bit inconsistent to me.
I would have expected that SaveToStream(AStream) would simply call
SaveToStream(AStream. Encoding).
It could of course be that Deplhi has implemented it that way (and we
must follow), but since my last Delphi version is D7, I cannot test
that.

-- 
Bart

Attachment: tstrings.saveto.diff
Description: Binary data

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to