msbuild
msbuild copied to clipboard
[Feature Request]: `WriteLinesToFile` should support specifying a UTF8 encoding that doesn't write a BOM
Summary
WriteLinesToFile accepts an Encoding metadata that is a name that's passed to System.Text.Encoding.GetEncoding. There is no BCL name for UTF-8 with no BOM, so users cannot easily request files be written in this encoding.
Background and Motivation
BOMs are not generally considered good things to require these days, and many systems (especially those that interact with Linux hosts/tools) have moved away from them because said tools don't handle BOMs well.
We should at least have a supported and documented way to skip BOM emission.
Proposed Feature
We should support a string like UTF8-no-bom or similar for the Encoding metadata of the WriteLinesToFile Task so that users have an accepted way to write without BOMs. And/or the runtime should provide a named lookup that does the same.
Alternative Designs
No response