[fpc-devel] TStrings and BOM
Bart
bartjunk64 at gmail.com
Wed Jan 1 13:00:39 CET 2020
On Wed, Jan 1, 2020 at 12:25 PM Bart <bartjunk64 at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tstrings.saveto.diff
Type: application/octet-stream
Size: 2203 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20200101/ebcb67e7/attachment.obj>
More information about the fpc-devel
mailing list