By default return an 'UTF8Unmarked' object. Removed unused 'utf8EncodingWithMarkers...
authorGerardo García Peña <killabytenow@gmail.com>
Thu, 23 May 2013 10:53:15 +0000 (12:53 +0200)
committerGerardo García Peña <killabytenow@gmail.com>
Thu, 23 May 2013 10:53:15 +0000 (12:53 +0200)
mcs/class/corlib/System.Text/Encoding.cs

index 97c2e5289aa36c07b8b85b37830c4b25964f6808..944a14014984b137ed3fb23b3caf0493be6e7726 100644 (file)
@@ -797,7 +797,6 @@ public abstract class Encoding : ICloneable
        static volatile Encoding bigEndianEncoding;
        static volatile Encoding defaultEncoding;
        static volatile Encoding utf7Encoding;
-       static volatile Encoding utf8EncodingWithMarkers;
        static volatile Encoding utf8EncodingWithoutMarkers;
        static volatile Encoding unicodeEncoding;
        static volatile Encoding isoLatin1Encoding;
@@ -937,23 +936,7 @@ public abstract class Encoding : ICloneable
        public static Encoding UTF8
        {
                get {
-                       if (utf8EncodingWithMarkers == null) {
-                               lock (lockobj) {
-                                       if (utf8EncodingWithMarkers == null) {
-                                               // MS.NET does not enable BOM
-                                               // preamble by default
-                                               // NOTE: In fact is a bad idea
-                                               // to add an UTF8 BOM because
-                                               // it breaks compatibility with
-                                               // ASCII (i.e. shell scripts):
-                                               // http://www.unicode.org/faq/utf_bom.html#bom5
-                                               utf8EncodingWithMarkers = new UTF8Encoding (false);
-//                                             utf8EncodingWithMarkers.is_readonly = true;
-                                       }
-                               }
-                       }
-
-                       return utf8EncodingWithMarkers;
+                       return UTF8Unmarked;
                }
        }