class Encoding

in global :: System . Text

Represents a character encoding.


public static Encoding ASCII { get; }

Gets an encoding for the ASCII (7-bit) character set.

  • Returns An encoding for the ASCII (7-bit) character set.

public static Encoding BigEndianUnicode { get; }

Gets an encoding for the UTF-16 format that uses the big endian byte order.

  • Returns An encoding object for the UTF-16 format that uses the big endian byte order.

public string BodyName { get; }

When overridden in a derived class, gets a name for the current encoding that can be used with mail agent body tags.

  • Returns A name for the current that can be used with mail agent body tags. -or- An empty string (""), if the current cannot be used.

public int CodePage { get; }

When overridden in a derived class, gets the code page identifier of the current .

  • Returns The code page identifier of the current .

public static byte[] Convert( Encoding srcEncoding, Encoding dstEncoding, byte[] bytes )

Converts an entire byte array from one encoding to another.

  • srcEncoding The encoding format of .
  • dstEncoding The target encoding format.
  • bytes The bytes to convert.
  • Returns An array of type containing the results of converting from to .

public static byte[] Convert( Encoding srcEncoding, Encoding dstEncoding, byte[] bytes, int index, int count )

Converts a range of bytes in a byte array from one encoding to another.

  • srcEncoding The encoding of the source array, .
  • dstEncoding The encoding of the output array.
  • bytes The array of bytes to convert.
  • index The index of the first element of to convert.
  • count The number of bytes to convert.
  • Returns An array of type containing the result of converting a range of bytes in from to .

public DecoderFallback DecoderFallback { get; set; }

Gets or sets the object for the current object.

  • Returns The decoder fallback object for the current object.

public static Encoding Default { get; }

Gets the default encoding for this .NET implementation.

  • Returns The default encoding for this .NET implementation.

public EncoderFallback EncoderFallback { get; set; }

Gets or sets the object for the current object.

  • Returns The encoder fallback object for the current object.

public string EncodingName { get; }

When overridden in a derived class, gets the human-readable description of the current encoding.

  • Returns The human-readable description of the current .

public bool Equals( object value )

Determines whether the specified is equal to the current instance.

  • value The to compare with the current instance.
  • Returns if is an instance of and is equal to the current instance; otherwise, .

public int GetByteCount( char* chars, int count )

When overridden in a derived class, calculates the number of bytes produced by encoding a set of characters starting at the specified character pointer.

  • chars A pointer to the first character to encode.
  • count The number of characters to encode.
  • Returns The number of bytes produced by encoding the specified characters.

public int GetByteCount( char[] chars )

When overridden in a derived class, calculates the number of bytes produced by encoding all the characters in the specified character array.

  • chars The character array containing the characters to encode.
  • Returns The number of bytes produced by encoding all the characters in the specified character array.

public int GetByteCount( char[] chars, int index, int count )

When overridden in a derived class, calculates the number of bytes produced by encoding a set of characters from the specified character array.

  • chars The character array containing the set of characters to encode.
  • index The index of the first character to encode.
  • count The number of characters to encode.
  • Returns The number of bytes produced by encoding the specified characters.

public int GetByteCount( string s )

When overridden in a derived class, calculates the number of bytes produced by encoding the characters in the specified string.

  • s The string containing the set of characters to encode.
  • Returns The number of bytes produced by encoding the specified characters.

public int GetByteCount( string s, int index, int count )

No summary.

public int GetBytes( char* chars, int charCount, byte* bytes, int byteCount )

When overridden in a derived class, encodes a set of characters starting at the specified character pointer into a sequence of bytes that are stored starting at the specified byte pointer.

  • chars A pointer to the first character to encode.
  • charCount The number of characters to encode.
  • bytes A pointer to the location at which to start writing the resulting sequence of bytes.
  • byteCount The maximum number of bytes to write.
  • Returns The actual number of bytes written at the location indicated by the parameter.

public byte[] GetBytes( char[] chars )

When overridden in a derived class, encodes all the characters in the specified character array into a sequence of bytes.

  • chars The character array containing the characters to encode.
  • Returns A byte array containing the results of encoding the specified set of characters.

public byte[] GetBytes( char[] chars, int index, int count )

When overridden in a derived class, encodes a set of characters from the specified character array into a sequence of bytes.

  • chars The character array containing the set of characters to encode.
  • index The index of the first character to encode.
  • count The number of characters to encode.
  • Returns A byte array containing the results of encoding the specified set of characters.

public int GetBytes( char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex )

When overridden in a derived class, encodes a set of characters from the specified character array into the specified byte array.

  • chars The character array containing the set of characters to encode.
  • charIndex The index of the first character to encode.
  • charCount The number of characters to encode.
  • bytes The byte array to contain the resulting sequence of bytes.
  • byteIndex The index at which to start writing the resulting sequence of bytes.
  • Returns The actual number of bytes written into .

public byte[] GetBytes( string s )

When overridden in a derived class, encodes all the characters in the specified string into a sequence of bytes.

  • s The string containing the characters to encode.
  • Returns A byte array containing the results of encoding the specified set of characters.

public byte[] GetBytes( string s, int index, int count )

No summary.

public int GetBytes( string s, int charIndex, int charCount, byte[] bytes, int byteIndex )

When overridden in a derived class, encodes a set of characters from the specified string into the specified byte array.

  • s The string containing the set of characters to encode.
  • charIndex The index of the first character to encode.
  • charCount The number of characters to encode.
  • bytes The byte array to contain the resulting sequence of bytes.
  • byteIndex The index at which to start writing the resulting sequence of bytes.
  • Returns The actual number of bytes written into .

public int GetCharCount( byte* bytes, int count )

When overridden in a derived class, calculates the number of characters produced by decoding a sequence of bytes starting at the specified byte pointer.

  • bytes A pointer to the first byte to decode.
  • count The number of bytes to decode.
  • Returns The number of characters produced by decoding the specified sequence of bytes.

public int GetCharCount( byte[] bytes )

When overridden in a derived class, calculates the number of characters produced by decoding all the bytes in the specified byte array.

  • bytes The byte array containing the sequence of bytes to decode.
  • Returns The number of characters produced by decoding the specified sequence of bytes.

public int GetCharCount( byte[] bytes, int index, int count )

When overridden in a derived class, calculates the number of characters produced by decoding a sequence of bytes from the specified byte array.

  • bytes The byte array containing the sequence of bytes to decode.
  • index The index of the first byte to decode.
  • count The number of bytes to decode.
  • Returns The number of characters produced by decoding the specified sequence of bytes.

public int GetChars( byte* bytes, int byteCount, char* chars, int charCount )

When overridden in a derived class, decodes a sequence of bytes starting at the specified byte pointer into a set of characters that are stored starting at the specified character pointer.

  • bytes A pointer to the first byte to decode.
  • byteCount The number of bytes to decode.
  • chars A pointer to the location at which to start writing the resulting set of characters.
  • charCount The maximum number of characters to write.
  • Returns The actual number of characters written at the location indicated by the parameter.

public char[] GetChars( byte[] bytes )

When overridden in a derived class, decodes all the bytes in the specified byte array into a set of characters.

  • bytes The byte array containing the sequence of bytes to decode.
  • Returns A character array containing the results of decoding the specified sequence of bytes.

public char[] GetChars( byte[] bytes, int index, int count )

When overridden in a derived class, decodes a sequence of bytes from the specified byte array into a set of characters.

  • bytes The byte array containing the sequence of bytes to decode.
  • index The index of the first byte to decode.
  • count The number of bytes to decode.
  • Returns A character array containing the results of decoding the specified sequence of bytes.

public int GetChars( byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex )

When overridden in a derived class, decodes a sequence of bytes from the specified byte array into the specified character array.

  • bytes The byte array containing the sequence of bytes to decode.
  • byteIndex The index of the first byte to decode.
  • byteCount The number of bytes to decode.
  • chars The character array to contain the resulting set of characters.
  • charIndex The index at which to start writing the resulting set of characters.
  • Returns The actual number of characters written into .

public static Encoding GetEncoding( int codepage )

Returns the encoding associated with the specified code page identifier.

  • codepage The code page identifier of the preferred encoding. Possible values are listed in the Code Page column of the table that appears in the class topic. -or- 0 (zero), to use the default encoding.
  • Returns The encoding that is associated with the specified code page.

public static Encoding GetEncoding( int codepage, EncoderFallback encoderFallback, DecoderFallback decoderFallback )

Returns the encoding associated with the specified code page identifier. Parameters specify an error handler for characters that cannot be encoded and byte sequences that cannot be decoded.

  • codepage The code page identifier of the preferred encoding. Possible values are listed in the Code Page column of the table that appears in the class topic. -or- 0 (zero), to use the default encoding.
  • encoderFallback An object that provides an error-handling procedure when a character cannot be encoded with the current encoding.
  • decoderFallback An object that provides an error-handling procedure when a byte sequence cannot be decoded with the current encoding.
  • Returns The encoding that is associated with the specified code page.

public static Encoding GetEncoding( string name )

Returns the encoding associated with the specified code page name.

  • name The code page name of the preferred encoding. Any value returned by the property is valid. Possible values are listed in the Name column of the table that appears in the class topic.
  • Returns The encoding associated with the specified code page.

public static Encoding GetEncoding( string name, EncoderFallback encoderFallback, DecoderFallback decoderFallback )

Returns the encoding associated with the specified code page name. Parameters specify an error handler for characters that cannot be encoded and byte sequences that cannot be decoded.

  • name The code page name of the preferred encoding. Any value returned by the property is valid. Possible values are listed in the Name column of the table that appears in the class topic.
  • encoderFallback An object that provides an error-handling procedure when a character cannot be encoded with the current encoding.
  • decoderFallback An object that provides an error-handling procedure when a byte sequence cannot be decoded with the current encoding.
  • Returns The encoding that is associated with the specified code page.

public int GetMaxByteCount( int charCount )

When overridden in a derived class, calculates the maximum number of bytes produced by encoding the specified number of characters.

  • charCount The number of characters to encode.
  • Returns The maximum number of bytes produced by encoding the specified number of characters.

public int GetMaxCharCount( int byteCount )

When overridden in a derived class, calculates the maximum number of characters produced by decoding the specified number of bytes.

  • byteCount The number of bytes to decode.
  • Returns The maximum number of characters produced by decoding the specified number of bytes.

public string GetString( byte* bytes, int byteCount )

When overridden in a derived class, decodes a specified number of bytes starting at a specified address into a string.

  • bytes A pointer to a byte array.
  • byteCount The number of bytes to decode.
  • Returns A string that contains the results of decoding the specified sequence of bytes.

public string GetString( byte[] bytes )

When overridden in a derived class, decodes all the bytes in the specified byte array into a string.

  • bytes The byte array containing the sequence of bytes to decode.
  • Returns A string that contains the results of decoding the specified sequence of bytes.

public string GetString( byte[] bytes, int index, int count )

When overridden in a derived class, decodes a sequence of bytes from the specified byte array into a string.

  • bytes The byte array containing the sequence of bytes to decode.
  • index The index of the first byte to decode.
  • count The number of bytes to decode.
  • Returns A string that contains the results of decoding the specified sequence of bytes.

public string HeaderName { get; }

When overridden in a derived class, gets a name for the current encoding that can be used with mail agent header tags.

  • Returns A name for the current to use with mail agent header tags. -or- An empty string (""), if the current cannot be used.

public bool IsAlwaysNormalized( NormalizationForm form )

When overridden in a derived class, gets a value indicating whether the current encoding is always normalized, using the specified normalization form.

  • form One of the values.
  • Returns if the current object is always normalized using the specified value; otherwise, . The default is .

public bool IsBrowserDisplay { get; }

When overridden in a derived class, gets a value indicating whether the current encoding can be used by browser clients for displaying content.

  • Returns if the current can be used by browser clients for displaying content; otherwise, .

public bool IsBrowserSave { get; }

When overridden in a derived class, gets a value indicating whether the current encoding can be used by browser clients for saving content.

  • Returns if the current can be used by browser clients for saving content; otherwise, .

public bool IsMailNewsDisplay { get; }

When overridden in a derived class, gets a value indicating whether the current encoding can be used by mail and news clients for displaying content.

  • Returns if the current can be used by mail and news clients for displaying content; otherwise, .

public bool IsMailNewsSave { get; }

When overridden in a derived class, gets a value indicating whether the current encoding can be used by mail and news clients for saving content.

  • Returns if the current can be used by mail and news clients for saving content; otherwise, .

public bool IsReadOnly { get; }

When overridden in a derived class, gets a value indicating whether the current encoding is read-only.

  • Returns if the current is read-only; otherwise, . The default is .

public bool IsSingleByte { get; }

When overridden in a derived class, gets a value indicating whether the current encoding uses single-byte code points.

  • Returns if the current uses single-byte code points; otherwise, .

public ReadOnlySpan<byte> Preamble { get; }

No summary.

public static void RegisterProvider( EncodingProvider provider )

Registers an encoding provider.

  • provider A subclass of that provides access to additional character encodings.

public static Encoding Unicode { get; }

Gets an encoding for the UTF-16 format using the little endian byte order.

  • Returns An encoding for the UTF-16 format using the little endian byte order.

public static Encoding UTF32 { get; }

Gets an encoding for the UTF-32 format using the little endian byte order.

  • Returns An encoding object for the UTF-32 format using the little endian byte order.

public static Encoding UTF7 { get; }

Gets an encoding for the UTF-7 format.

  • Returns An encoding for the UTF-7 format.

public static Encoding UTF8 { get; }

Gets an encoding for the UTF-8 format.

  • Returns An encoding for the UTF-8 format.

public string WebName { get; }

When overridden in a derived class, gets the name registered with the Internet Assigned Numbers Authority (IANA) for the current encoding.

  • Returns The IANA name for the current .

public int WindowsCodePage { get; }

When overridden in a derived class, gets the Windows operating system code page that most closely corresponds to the current encoding.

  • Returns The Windows operating system code page that most closely corresponds to the current .

public string ToString( )

😔 No documentation found.

public static Stream CreateTranscodingStream( Stream innerStream, Encoding innerStreamEncoding, Encoding outerStreamEncoding, bool leaveOpen = False )

😔 No documentation found.

public int GetHashCode( )

😔 No documentation found.

public object Clone( )

😔 No documentation found.

public static Encoding Latin1 { get; }

😔 No documentation found.

public Encoder GetEncoder( )

😔 No documentation found.

public Decoder GetDecoder( )

😔 No documentation found.

public bool IsAlwaysNormalized( )

😔 No documentation found.

public int GetByteCount( ReadOnlySpan<char> chars )

😔 No documentation found.

public string GetString( ReadOnlySpan<byte> bytes )

😔 No documentation found.

public byte[] GetPreamble( )

😔 No documentation found.

public bool TryGetChars( ReadOnlySpan<byte> bytes, Span<char> chars, ref int charsWritten )

😔 No documentation found.

public int GetChars( ReadOnlySpan<byte> bytes, Span<char> chars )

😔 No documentation found.

public static EncodingInfo[] GetEncodings( )

😔 No documentation found.

public Type GetType( )

😔 No documentation found.

public int GetBytes( ReadOnlySpan<char> chars, Span<byte> bytes )

😔 No documentation found.

public bool TryGetBytes( ReadOnlySpan<char> chars, Span<byte> bytes, ref int bytesWritten )

😔 No documentation found.

public int GetCharCount( ReadOnlySpan<byte> bytes )

😔 No documentation found.