TextDecoderStream: encoding 属性
注意:此功能在 Web Workers 中可用。
TextDecoderStream 接口的 encoding 只读属性返回一个字符串,其中包含特定解码器使用的编码算法的名称。
编码由 构造函数的 label 参数设置,默认为 utf-8。
值
包含编码格式的小写 ASCII 名称的字符串。
允许的值与 TextDecoder.encoding 中列出的值相同(编码 API 编码中的标签)。
示例
从 TextDecoderStream 返回 encoding 的值。
js
stream = new TextDecoderStream();
console.log(stream.encoding); // returns the default "utf-8"
规范
| 规范 |
|---|
| 编码 # dom-textdecoder-encoding |
浏览器兼容性
加载中…