The TextDecoder interface represents a decoder for a specific method, that is a specific character encoding, like utf-8, iso-8859-2, koi8, cp1261, gbk, etc. A decoder takes a stream of bytes as input and emits a stream of code points. For a more scalable, non-native library, see StringView – a C-like representation of strings based on typed arrays.

Documentation TextDecoder by Mozilla Contributors, licensed under CC-BY-SA 2.5.

See also:

Constructor

@:value({ label : "utf-8" })new(label:String = "utf-8", ?options:Null<TextDecoderOptions>)

Throws:

null

DOMError

Variables

read onlyencoding:String

Is a DOMString containing the name of the decoder, that is a string describing the method the TextDecoder will use.

read onlyfatal:Bool

Is a Boolean indicating whether the error mode is fatal.

read onlyignoreBOM:Bool

Is a Boolean indicating whether the byte order marker is ignored.

Methods

decode(?input:ArrayBufferView, ?options:Null<TextDecodeOptions>):String

decode(?input:ArrayBuffer, ?options:Null<TextDecodeOptions>):String

Returns a DOMString containing the text decoded with the method of the specific TextDecoder object.

Throws:

null

DOMError