Skip to content

Add UTF8NoBOM property to System.Text.Encoding class #2312

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

augustoproiete
Copy link

This PR adds a new property to the System.Text.Encoding class called UTF8NoBOM with an instance of the UTF8Encoding class configured to not include the byte order mark (BOM).

I opted to use the name UTF8NoBOM because it's the name used in the internal EncodingCache class that is referenced in several places throughout the codebase.

For consistency with other properties of the Encoding class such as UTF8 for example, The argument throwOnInvalidBytes is not set on the constructor and it will use the default (false). This means we wouldn't be able to replace references to EncodingCache.UTF8NoBOM with references to Encoding.UTF8NoBOM as they have different behavior.

Resolves #2136 if we want to stop here for now, unless we want to also add other similar properties together such as UnicodeNoBOM and UTF32NoBOM, etc. as suggested in #2136.

@jkotas
Copy link
Member

jkotas commented Jan 29, 2020

Thank you for the contribution. The API needs to be approved first. https://github.com/dotnet/runtime/blob/master/docs/project/api-review-process.md describes the process we follow for adding new APIs.

I am going to close this PR until the API gets approved.

@jkotas jkotas closed this Jan 29, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add UTF8NoBom property to System.Text.Encoding class
3 participants