CrossAppDomainChannel.cs: Make _ContextID an object that fixes bug #422491.
[mono.git] / mcs / class / corlib / System.Text / UnicodeEncoding.cs
index a64686562974f59d7ff954952da614ea9619f798..451d1d231e93a0b832d652c3d910b9c964227a03 100644 (file)
@@ -58,8 +58,23 @@ public class UnicodeEncoding : Encoding
                byteOrderMark = true;
        }
        public UnicodeEncoding (bool bigEndian, bool byteOrderMark)
+               : this (bigEndian, byteOrderMark, false)
+       {
+       }
+
+#if NET_2_0
+       public
+#endif
+       UnicodeEncoding (bool bigEndian, bool byteOrderMark, bool throwOnInvalidBytes)
                : base ((bigEndian ? BIG_UNICODE_CODE_PAGE : UNICODE_CODE_PAGE))
        {
+#if NET_2_0
+               if (throwOnInvalidBytes)
+                       SetFallbackInternal (null, new DecoderExceptionFallback ());
+               else
+                       SetFallbackInternal (null, new DecoderReplacementFallback ("\uFFFD"));
+#endif
+
                this.bigEndian = bigEndian;
                this.byteOrderMark = byteOrderMark;
 
@@ -82,14 +97,6 @@ public class UnicodeEncoding : Encoding
                windows_code_page = UNICODE_CODE_PAGE;
        }
 
-#if NET_2_0
-       [MonoTODO ("Implement throwOnInvalidBytes")]
-       public UnicodeEncoding (bool bigEndian, bool byteOrderMark, bool throwOnInvalidBytes)
-               : this (bigEndian, byteOrderMark)
-       {
-       }
-#endif
-
        // Get the number of bytes needed to encode a character buffer.
        public override int GetByteCount (char[] chars, int index, int count)
        {