* Make Encoding.Default return UTF8 without BOM emission
* Remove SL reference in the code
* Remove the static cache
Encoding enc;
-
- // For silverlight we use UTF8 since ANSI isn't available
- enc = UTF8;
-
+ // For netcore we use UTF8 since ANSI isn't available
+ enc = new UTF8Encoding.UTF8EncodingSealed(encoderShouldEmitUTF8Identifier: false);
// This method should only ever return one Encoding instance
return Interlocked.CompareExchange(ref defaultEncoding, enc, null) ?? enc;
internal sealed class UTF8EncodingSealed : UTF8Encoding
{
public UTF8EncodingSealed() : base(encoderShouldEmitUTF8Identifier: true) { }
+ public UTF8EncodingSealed(bool encoderShouldEmitUTF8Identifier) : base(encoderShouldEmitUTF8Identifier) { }
}
// Used by Encoding.UTF8 for lazy initialization