EncoderExceptionFallbackBuffer.Fallback Method

Definition

Throws an exception because the input character cannot be encoded. The nominal return value is not used.

Overloads

Fallback(Char, Int32)

Throws an exception because the input character cannot be encoded. Parameters specify the value and index position of the character that cannot be converted.

Fallback(Char, Char, Int32)

Throws an exception because the input character cannot be encoded. Parameters specify the value and index position of the surrogate pair in the input, and the nominal return value is not used.

Fallback(Char, Int32)

Source:
EncoderExceptionFallback.cs
Source:
EncoderExceptionFallback.cs
Source:
EncoderExceptionFallback.cs

Throws an exception because the input character cannot be encoded. Parameters specify the value and index position of the character that cannot be converted.

public override bool Fallback (char charUnknown, int index);

Parameters

charUnknown
Char

An input character.

index
Int32

The index position of the character in the input buffer.

Returns

None. No value is returned because the Fallback(Char, Int32) method always throws an exception.

Exceptions

charUnknown cannot be encoded. This method always throws an exception that reports the value of the charUnknown and index parameters.

Remarks

The GetBytes and Convert methods call Fallback if they encounter an unknown character in their input. In response, Fallback always throws EncoderFallbackException.

Applies to

.NET 9 and other versions
Product Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

Fallback(Char, Char, Int32)

Source:
EncoderExceptionFallback.cs
Source:
EncoderExceptionFallback.cs
Source:
EncoderExceptionFallback.cs

Throws an exception because the input character cannot be encoded. Parameters specify the value and index position of the surrogate pair in the input, and the nominal return value is not used.

public override bool Fallback (char charUnknownHigh, char charUnknownLow, int index);

Parameters

charUnknownHigh
Char

The high surrogate of the input pair.

charUnknownLow
Char

The low surrogate of the input pair.

index
Int32

The index position of the surrogate pair in the input buffer.

Returns

None. No value is returned because the Fallback(Char, Char, Int32) method always throws an exception.

Exceptions

The character represented by charUnknownHigh and charUnknownLow cannot be encoded.

Either charUnknownHigh or charUnknownLow is invalid. charUnknownHigh is not between U+D800 and U+DBFF, inclusive, or charUnknownLow is not between U+DC00 and U+DFFF, inclusive.

Remarks

The GetBytes and Convert methods call Fallback if they encounter a surrogate pair in their input. In response, Fallback always throws an exception.

Applies to

.NET 9 and other versions
Product Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1