类:util.TextEncoder
🌐 Class: util.TextEncoder
版本历史
| 版本 | 变更 |
|---|---|
| v11.0.0 | The class is now available on the global object. |
| v8.3.0 | 新增于: v8.3.0 |
WHATWG 编码标准 TextEncoder API 的一个实现。所有 TextEncoder 实例只支持 UTF-8 编码。
🌐 An implementation of the WHATWG Encoding Standard TextEncoder API. All
instances of TextEncoder only support UTF-8 encoding.
const encoder = new TextEncoder();
const uint8array = encoder.encode('this is some data'); TextEncoder 类也可以在全局对象上使用。
🌐 The TextEncoder class is also available on the global object.