System.Text.EncoderFallback Class

Provides a failure-handling mechanism, called a fallback, for an input character that cannot be converted to an encoded output byte sequence.

See Also: EncoderFallback Members

Syntax

public abstract class EncoderFallback

Remarks

An encoding maps a Unicode character to an encoded sequence of bytes. A particular encoding is represented by a type that is derived from the System.Text.Encoding class. Specifically, a character is encoded to a byte sequence by calling the encoding type's Encoding.GetBytes(string) method, and the byte sequence is decoded to a character array or a string by calling the Encoding.GetChars(Byte[]) or Encoding.GetString(Byte[]) method.

An encoding operation can fail if the input character cannot be represented by the encoding. For example, an System.Text.ASCIIEncoding object cannot encode a character whose Unicode code point value is outside the range U+0000 to U+007F.

When an encoding conversion cannot be performed, the .NET Framework provides a failure-handling mechanism called a fallback. Your application can use predefined .NET Framework encoder fallbacks, or it can create a custom encoder fallback derived from the System.Text.EncoderFallback and System.Text.EncoderFallbackBuffer classes.

System.Text.EncoderFallback and System.Text.EncoderFallbackBuffer are the base classes for all encoding fallback handlers in the .NET Framework. They support the following three kinds of fallback handling mechanisms:

If you choose to implement a custom solution, you must override the following abstract members of the System.Text.EncoderFallback class:

For more information about encoding, decoding, and fallback strategies, see Character Encoding in the .NET Framework.

Requirements

Namespace: System.Text
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0