O'Reilly logo

C# in a Nutshell by Peter Drayton, Ted Neward, Ben Albahari

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required