此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in English Always switch to English

TextDecoderStream.encoding

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨2022年9月⁩.

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

一个小写的 ASCII 字符串。

示例

从一个 TextDecoderStream 返回 encoding 的值。

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

规范

Specification
Encoding
# dom-textdecoder-encoding

浏览器兼容性