类:util.TextEncoder
\Class: util.TextEncoder
版本历史
| 版本 | 变更 |
|---|---|
| v11.0.0 | 该类现在也在全局对象上可用。 |
| 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.