TextDecoderStream: encoding property
Baseline Widely availableThis feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2022.
>Note: This feature is available in Web Workers.
The encoding read-only property of the TextDecoderStream interface returns a string containing the name of the encoding algorithm used by the specific decoder.
The encoding is set by the constructor label parameter, and defaults to utf-8.
Value
A string containing the lower-cased ASCII name of the encoding format.
The allowed values are the same as those listed in TextDecoder.encoding (the labels in Encoding API Encodings).
Examples
Returning the value of encoding from a TextDecoderStream.
stream = new TextDecoderStream();
console.log(stream.encoding); // returns the default "utf-8"
Specifications
| Specification |
|---|
| Encoding > # dom-textdecoder-encoding > |
Browser compatibility
Help improve MDN
Was this page helpful to you? Yes No Learn how to contributeThis page was last modified on Sep 25, 2024 by MDN contributors.
View this page on GitHub • Report a problem with this content