TextDecoder Class

https://encoding.spec.whatwg.org/#interface-textdecoder

public sealed class TextDecoder

Constructors

NameDescription
TextDecoder(string, TextDecoderOptions?)Creates a decoder for the encoding identified by the given label.

TextDecoder(string, TextDecoderOptions?)

TextDecoder.cs

Creates a decoder for the encoding identified by the given label.

public TextDecoder(string label = "utf-8", TextDecoderOptions? options = null)

Properties

NameDescription
EncodingGets the encoding's name, ASCII lowercased.
FatalGets a value indicating whether decoding throws on invalid data instead of using replacement characters.
IgnoreBomGets a value indicating whether the byte order mark is kept in the decoded output.

Gets the encoding's name, ASCII lowercased.

public string Encoding { get; }

Gets a value indicating whether decoding throws on invalid data instead of using replacement characters.

public bool Fatal { get; }

Gets a value indicating whether the byte order mark is kept in the decoded output.

public bool IgnoreBom { get; }

Methods

NameDescription
Decode(ReadOnlySpan<byte>, TextDecodeOptions?)Decodes the bytes (https://encoding.spec.whatwg.org/#dom-textdecoder-decode): a missing input is an empty input.

Decode(ReadOnlySpan<byte>, TextDecodeOptions?)

TextDecoder.cs

Decodes the bytes (https://encoding.spec.whatwg.org/#dom-textdecoder-decode): a missing input is an empty input.

public string Decode(ReadOnlySpan<byte> input = default, TextDecodeOptions? options = null)