59 references to SupportedEncoding
System.Runtime.Serialization (59)
System\Xml\EncodingStreamWrapper.cs (59)
37SupportedEncoding encodingCode;
60SupportedEncoding expectedEnc = GetSupportedEncoding(encoding);
64SupportedEncoding declEnc = ReadBOMEncoding(encoding == null);
67if (expectedEnc != SupportedEncoding.None && expectedEnc != declEnc)
71if (declEnc == SupportedEncoding.UTF8)
102if (expectedEnc == SupportedEncoding.None)
113void SetReadDocumentEncoding(SupportedEncoding e)
120static Encoding GetEncoding(SupportedEncoding e)
124case SupportedEncoding.UTF8:
127case SupportedEncoding.UTF16LE:
130case SupportedEncoding.UTF16BE:
138static Encoding GetSafeEncoding(SupportedEncoding e)
142case SupportedEncoding.UTF8:
145case SupportedEncoding.UTF16LE:
148case SupportedEncoding.UTF16BE:
156static string GetEncodingName(SupportedEncoding enc)
160case SupportedEncoding.UTF8:
163case SupportedEncoding.UTF16LE:
166case SupportedEncoding.UTF16BE:
174static SupportedEncoding GetSupportedEncoding(Encoding encoding)
177return SupportedEncoding.None;
179return SupportedEncoding.UTF8;
181return SupportedEncoding.UTF16LE;
183return SupportedEncoding.UTF16BE;
198if (encodingCode != SupportedEncoding.UTF8)
214SupportedEncoding ReadBOMEncoding(bool notOutOfBand)
226SupportedEncoding e = ReadBOMEncoding((byte)b1, (byte)b2, (byte)b3, (byte)b4, notOutOfBand, out preserve);
252static SupportedEncoding ReadBOMEncoding(byte b1, byte b2, byte b3, byte b4, bool notOutOfBand, out int preserve)
254SupportedEncoding e = SupportedEncoding.UTF8; // Default
259e = SupportedEncoding.UTF8;
264e = SupportedEncoding.UTF16LE;
269e = SupportedEncoding.UTF16BE;
274e = SupportedEncoding.UTF16BE;
282e = SupportedEncoding.UTF16LE;
334static void CheckUTF8DeclarationEncoding(byte[] buffer, int offset, int count, SupportedEncoding e, SupportedEncoding expectedEnc)
376if (e != SupportedEncoding.UTF8 && expectedEnc == SupportedEncoding.None)
390if (e != SupportedEncoding.UTF8 && expectedEnc == SupportedEncoding.None)
413SupportedEncoding declEnc = e;
416declEnc = SupportedEncoding.UTF8;
420declEnc = SupportedEncoding.UTF16LE;
424declEnc = SupportedEncoding.UTF16BE;
428if (e == SupportedEncoding.UTF8)
478SupportedEncoding expectedEnc = GetSupportedEncoding(encoding);
479SupportedEncoding declEnc = ReadBOMEncoding(buffer[offset], buffer[offset + 1], buffer[offset + 2], buffer[offset + 3], encoding == null, out preserve);
480if (expectedEnc != SupportedEncoding.None && expectedEnc != declEnc)
490if (declEnc == SupportedEncoding.UTF8)
520if (expectedEnc == SupportedEncoding.None)
533static void ThrowExpectedEncodingMismatch(SupportedEncoding expEnc, SupportedEncoding actualEnc)
538static void ThrowEncodingMismatch(string declEnc, SupportedEncoding enc)
610if (byteCount == 0 && encodingCode == SupportedEncoding.UTF8)
623if (encodingCode == SupportedEncoding.UTF8)
673if (encodingCode == SupportedEncoding.UTF16LE)
700if (encodingCode == SupportedEncoding.UTF8)
712if (encodingCode == SupportedEncoding.UTF8)