Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1019,6 +1019,11 @@ public virtual string GetString(byte[] bytes, int index, int count) =>

public static Encoding UTF8 => UTF8Encoding.s_default;

// Returns an encoding for the UTF-8 format without BOM. The returned encoding will be
// an instance of the UTF8Encoding class.

public static Encoding UTF8NoBOM => UTF8Encoding.s_noBom;

// Returns an encoding for the UTF-32 format. The returned encoding will be
// an instance of the UTF32Encoding class.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ 4 21 11110vvv 10vvvvvv 10vvvvvv 10vvvvvv
// The initialization code will not be run until a static member of the class is referenced
internal static readonly UTF8EncodingSealed s_default = new UTF8EncodingSealed(encoderShouldEmitUTF8Identifier: true);

// Used by Encoding.UTF8NoBOM for lazy initialization
// The initialization code will not be run until a static member of the class is referenced
internal static readonly UTF8EncodingSealed s_noBom = new UTF8EncodingSealed(encoderShouldEmitUTF8Identifier: false);

internal static ReadOnlySpan<byte> PreambleSpan => new byte[3] { 0xEF, 0xBB, 0xBF }; // uses C# compiler's optimization for static byte[] data

// Yes, the idea of emitting U+FEFF as a UTF-8 identifier has made it into
Expand Down