Encoding
Encoding Standard (subset)
Module:whatwg.encoding
Support: Experimental
Since: 1.1.0
Docs: WHATWG Docs
Dictionary TextDecoderOptions
Since: 1.1.0
Docs: WHATWG Docs
2 members: 2 undocumented
Properties
If true, decoding errors cause an exception rather than replacement characters.
If true, the BOM is not stripped from the start of the decoded string.
---
Dictionary TextDecodeOptions
Since: 1.1.0
Docs: WHATWG Docs
1 members: 1 undocumented
Properties
If true, decodes incrementally, holding back incomplete sequences for the next call.
---
Interface TextDecoder
Decodes a binary buffer into a string using a specified character encoding.
Since: 1.1.0 Docs: WHATWG Docs5 members: 5 undocumented
Constructors
Methods
Properties
→ string
If true, decoding errors cause an exception rather than replacement characters.
If true, the BOM is not stripped from the start of the decoded string.
---
Details
constructor(label, options)
new constructor(label?: string, options?: TextDecoderOptions)
new constructor(label?: string, options?: TextDecoderOptions)
| Parameter | Type | Description |
|---|---|---|
label (optional) | string | The encoding label (e.g. "utf-8", "utf-16le"). Defaults to "utf-8". |
options (optional) | TextDecoderOptions | Decoder options controlling error handling and BOM behavior. |
RangeError--- Iflabelis not a valid encoding label.
encoding
encoding: string
encoding: string
Throws:RangeError--- Iflabelis not a valid encoding label.
decode(input, options)
decode(input?: BufferSource, options?: TextDecodeOptions): string
decode(input?: BufferSource, options?: TextDecodeOptions): string
| Parameter | Type | Description |
|---|---|---|
input (optional) | BufferSource | The buffer to decode. |
options (optional) | TextDecodeOptions | Options for streaming decode. |
TypeError--- Iffatalis true and the input contains invalid sequences.
---
Interface TextEncoder
Encodes a string into a UTF-8 byte sequence.
Since: 1.1.0 Docs: WHATWG Docs4 members: 4 undocumented
Constructors
Methods
Properties
→ string
---
Details
constructor()
new constructor()
new constructor()
Throws:RangeError--- Iflabelis not a valid encoding label.
encoding
encoding: string
encoding: string
Throws:RangeError--- Iflabelis not a valid encoding label.
---
Dictionary TextEncoderEncodeIntoResult
Encodes source into destination without allocating a new buffer.
2 members: 2 undocumented
Properties
Result returned by TextEncoder.encodeInto().
The number of UTF-16 code units read from the source string.
---