Add option on StreamWriter not to emit Byte Order Mark (BOM)
Someone posted on CoreClr: https://github.com/dotnet/coreclr/issues/933 a requirement to have StreamWriter to optionally not emit BOM to the stream.
A possible solution is to either add a defaulted bool parameter to each/some of the constructors (bool emitBOM = True), or add a new enum e.g. StreamWriterOptions with EmitBOM as one of the enums and again having that enum as a defaulted parameter on each/some of the constructors.
There maybe an issue with binary compatibility so it might be better to add a new constructor with the bool/enum.'
Comments?
Thanks I passed that on to original poster
The issue with the original poster (From the asp.net project) is that encoder is passed to him (either with the flag on or off) but yet he needs to suppress the BOM regardless; see the link in my original post in to the coreclr post.
You can create your custom wrapping Encoding class and return exactly what wrapped object with the only exception to return empty array in GetPreamble method.
We're are not opposed but it seems if there is a workaround, it's lower priority. @bpschoch, please feel free to come up with a proposal.
Assigning to @JeremyKuhne since he owns System.IO.
There's a workaround, noone proposed another solution, closing. If anyone comes up with a proposal, feel free to reopen.