dotnet/msbuild

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

Open

#10,521 创建于 2024年8月14日

在 GitHub 查看
 (12 评论) (0 反应) (0 负责人)C# (5,062 star) (1,364 fork)batch import
Feature RequestPriority:3help wantedtriaged

描述

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

贡献者指南

[Feature Request]: `WriteLinesToFile` should support specifying a UTF8 encoding that doesn't write a BOM · dotnet/msbuild#10521 | Good First Issue