Name

UTF8Encoding

Synopsis

This class encodes Unicode characters as UTF-8, 8-bit characters. The overloaded constructor allows zero, one, or two boolean parameters. The first argument indicates whether the encoder should both emit the UTF-8 byte order mark code and recognize it. The second boolean argument specifies whether to throw an exception when invalid bytes are encountered.

public class UTF8Encoding : Encoding {
// Public Constructors
   public method UTF8Encoding();  
   public method UTF8Encoding(
        bool encoderShouldEmitUTF8Identifier);  
   public method UTF8Encoding(
        bool encoderShouldEmitUTF8Identifier, 
        bool throwOnInvalidBytes);  
// Public Instance Methods
   public override method bool Equals(object value);            // overrides Encoding
   public override method int GetByteCount(char[] chars,         // overrides Encoding
        int index, int count);  
   public override method int GetByteCount(string chars);       // overrides Encoding
   public override method byte[] GetBytes(string s);            // overrides Encoding
   public override method int GetBytes(char[] chars,             // overrides Encoding
        int charIndex, int charCount, byte[] bytes, 
        int byteIndex);  
   public override method int GetBytes(string s,                 // overrides Encoding
        int charIndex, int charCount, byte[] bytes, 
        int byteIndex);  
   public override method int GetCharCount(byte[] bytes,         // overrides Encoding
        int index, int count);  
   public override method int GetChars(byte[] bytes,             // overrides Encoding
        int byteIndex, int byteCount, char[] chars, 
        int charIndex); public override method Decoder ...

Get C# in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.