这是 实验性技术
检查 浏览器兼容性表格 要小心谨慎在生产中使用这之前。

编码 API provides a mechanism for handling text in various character encodings , including legacy non- UTF-8 encodings.

The API provides four interfaces: TextDecoder , TextEncoder , TextDecoderStream and TextEncoderStream .

接口

Tutorials & tools

  • shim allowing to use this interface in browsers that don't support it.
  • StringView – a C-like representation of strings based on typed arrays.

规范

规范 状态 注释
编码 实时标准 初始定义。

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.

TextDecoder

更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
TextDecoder Chrome 38 Edge ≤79 Firefox 19
19
部分支持 18 注意事项
Implemented a slightly different version of the spec.
IE 不支持 No Opera 25 Safari 10.1 WebView Android 38 Chrome Android 38 Firefox Android 19
19
部分支持 18 注意事项
Implemented a slightly different version of the spec.
Opera Android Yes Safari iOS 10.3 Samsung Internet Android 3.0
TextDecoder() 构造函数 Chrome 38 Edge ≤79 Firefox 19
19
部分支持 18 注意事项
Implemented a slightly different version of the spec.
IE 不支持 No Opera 25 Safari 10.1 WebView Android 38 Chrome Android 38 Firefox Android 19
19
部分支持 18 注意事项
Implemented a slightly different version of the spec.
Opera Android ? Safari iOS 10.3 Samsung Internet Android 3.0
decode Chrome 38 Edge ≤79 Firefox 19
19
部分支持 18 注意事项
Implemented a slightly different version of the spec.
IE 不支持 No Opera 25 Safari 10.1 WebView Android 38 Chrome Android 38 Firefox Android 19
19
部分支持 18 注意事项
Implemented a slightly different version of the spec.
Opera Android Yes Safari iOS 10.3 Samsung Internet Android 3.0
encoding Chrome 38 Edge ≤79 Firefox 19
19
部分支持 18 注意事项
Implemented a slightly different version of the spec.
IE 不支持 No Opera 25 Safari 10.1 WebView Android 38 Chrome Android 38 Firefox Android 19
19
部分支持 18 注意事项
Implemented a slightly different version of the spec.
Opera Android Yes Safari iOS 10.3 Samsung Internet Android 3.0
fatal Chrome Yes Edge ≤79 Firefox Yes IE 不支持 No Opera Yes Safari 10.1 WebView Android Yes Chrome Android Yes Firefox Android Yes Opera Android Yes Safari iOS 10.3 Samsung Internet Android Yes
ignoreBOM Chrome Yes Edge ≤79 Firefox Yes IE 不支持 No Opera Yes Safari 10.1 WebView Android Yes Chrome Android Yes Firefox Android Yes Opera Android Yes Safari iOS 10.3 Samsung Internet Android Yes
Available in workers Chrome 38 Edge ≤79 Firefox 20 IE 不支持 No Opera 25 Safari 10.1 WebView Android 38 Chrome Android 38 Firefox Android 20 Opera Android ? Safari iOS 10.3 Samsung Internet Android 3.0

图例

完整支持

完整支持

不支持

不支持

兼容性未知 ?

兼容性未知

见实现注意事项。

TextEncoder

更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
TextEncoder Chrome 38 Edge 79 Firefox 19
19
18 注意事项
Firefox 18 implemented an earlier and slightly different version of the specification.
IE 不支持 No Opera 25 Safari 10.1 WebView Android 38 Chrome Android 38 Firefox Android 19
19
18 注意事项
Firefox 18 implemented an earlier and slightly different version of the specification.
Opera Android Yes Safari iOS 10.3 Samsung Internet Android 3.0
TextEncoder() 构造函数 Chrome 53 注意事项
53 注意事项
Does not accept parameters. Supports only utf-8 编码。
38 — 53 注意事项
抛出 RangeError exception for unknown encoding types.
Edge 79 注意事项
79 注意事项
Does not accept parameters. Supports only utf-8 编码。
Firefox 48 注意事项
48 注意事项
The constructor accepts an encoding type label argument, but the value is ignored. Only utf-8 encoding is supported.
38 — 48 注意事项
If the encoding type label argument is invalid, then a RangeError exception is thrown.
19 — 38 注意事项
If the encoding type label argument is invalid, then a TypeError exception is thrown.
18 注意事项
Firefox 18 implemented an earlier and slightly different version of the specification.
IE 不支持 No Opera 25 Safari 10.1 WebView Android 38 Chrome Android 38 Firefox Android 48 注意事项
48 注意事项
The constructor accepts an encoding type label argument, but the value is ignored. Only utf-8 encoding is supported.
38 — 48 注意事项
If the encoding type label argument is invalid, then a RangeError exception is thrown.
19 — 38 注意事项
If the encoding type label argument is invalid, then a TypeError exception is thrown.
18 注意事项
Firefox 18 implemented an earlier and slightly different version of the specification.
Opera Android ? Safari iOS 10.3 Samsung Internet Android 3.0
encode Chrome 38 Edge 79 Firefox 19
19
18 注意事项
Firefox 18 implemented an earlier and slightly different version of the specification.
IE 不支持 No Opera 25 Safari 10.1 WebView Android 38 Chrome Android 38 Firefox Android 19
19
18 注意事项
Firefox 18 implemented an earlier and slightly different version of the specification.
Opera Android Yes Safari iOS 10.3 Samsung Internet Android 3.0
encodeInto Chrome 74 Edge 79 Firefox 66 IE 不支持 No Opera 不支持 No Safari 不支持 No WebView Android 74 Chrome Android 74 Firefox Android 66 Opera Android 不支持 No Safari iOS 不支持 No Samsung Internet Android 11.0
encoding Chrome 38 Edge 79 Firefox 19
19
18 注意事项
Firefox 18 implemented an earlier and slightly different version of the specification.
IE 不支持 No Opera 25 Safari 10.1 WebView Android 38 Chrome Android 38 Firefox Android 19
19
18 注意事项
Firefox 18 implemented an earlier and slightly different version of the specification.
Opera Android Yes Safari iOS 10.3 Samsung Internet Android 3.0
Available in workers Chrome 38 Edge 79 Firefox 20 IE 不支持 No Opera 25 Safari 10.1 WebView Android 38 Chrome Android 38 Firefox Android 20 Opera Android ? Safari iOS 10.3 Samsung Internet Android 3.0

图例

完整支持

完整支持

不支持

不支持

兼容性未知 ?

兼容性未知

实验。期望将来行为有所改变。

实验。期望将来行为有所改变。

见实现注意事项。

元数据

  • 最后修改:
  1. 编码 API
  2. 接口
    1. TextDecoder
    2. TextEncoder

版权所有  © 2014-2026 乐数软件    

工业和信息化部: 粤ICP备14079481号-1