TextDecoderStream.encoding

TextDecoderStream 接口的只读属性 encoding 返回一个字符串,其中包含指定的 encoder 使用的编码算法的名称。

一个小写的 ASCII 字符串。

示例

从一个 TextDecoderStream 返回 encoding 的值。

js
stream = new TextDecoderStream();
console.log(stream.encoding); // returns the default "utf-8"

规范

Specification
Encoding
# dom-textdecoder-encoding

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobileserver
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Deno
Node.js
encoding

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support