If the TEncoding
used with TStreamWriter
defines a BOM, TStreamWriter
will write it. There is no option to disable that logic.
One way to avoid the BOM would be to derive a new class from TEncoding
that overrides the virtual GetPreamble()
method to return an empty byte array, and overrides the other methods to delegate work to another TEncoding
.