dotnet / dotnet/msbuild

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

Open
#10,521 12 comments 0 reactions 0 assignees View on GitHub
Feature Request help wanted Priority:3 triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

### 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_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.