dotnet/msbuild

[Feature Request]: `WriteLinesToFile` should support specifying a UTF8 encoding that doesn't write a BOM

Open

#10.521 aperta il 14 ago 2024

Vedi su GitHub
 (12 commenti) (0 reazioni) (0 assegnatari)C# (1364 fork)batch import
Feature RequestPriority:3help wantedtriaged

Metriche repository

Star
 (5062 star)
Metriche merge PR
 (Merge medio 6g 6h) (144 PR mergiate in 30 g)

Descrizione

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

Guida contributor