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

View in English Always switch to English

TextEncoder()

Baseline Widely available

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

TextEncoder() 构造函数总是返回一个新创建的 TextEncoder 对象,该对象将生成具有 UTF-8 编码的字节流。

语法

js
new TextEncoder();

参数

无。

规范

Specification
Encoding
# ref-for-dom-textencoder①

浏览器兼容性

参见