这是
实验性技术
检查
浏览器兼容性表格
要小心谨慎在生产中使用这之前。
TextDecoder.prototype.encoding
只读特性返回
DOMString
containing the name of the decoding algorithm used by the specific decoder.
It can be one of the following values:
'utf-8'
.
'ibm866'
,
'iso-8859-2'
,
'iso-8859-3'
,
'iso-8859-4'
,
'iso-8859-5'
,
'iso-8859-6'
,
'iso-8859-7'
,
'iso-8859-8'
'
,
'iso-8859-8i'
,
'iso-8859-10'
,
'iso-8859-13'
,
'iso-8859-14'
,
'iso-8859-15'
,
'iso-8859-16'
,
'koi8-r'
,
'koi8-u'
,
'macintosh'
,
'windows-874'
,
'windows-1250'
,
'windows-1251'
,
'windows-1252'
,
'windows-1253'
,
'windows-1254'
,
'windows-1255'
,
'windows-1256'
,
'windows-1257'
,
'windows-1258'
,或
'x-mac-cyrillic'
.
'gbk'
,
'gb18030'
,和
'hz-gb-2312'
.
'big5'
.
'euc-jp'
,
'iso-2022-jp'
,和
'shift-jis'
.
'euc-kr'
,和
'iso-2022-kr'
.
'utf-16be'
,
'utf-16le'
,和
'x-user-defined'
.
'replacement'
, which only emits an error and an
EOF
code point. It is used to prevent attacks that mismatch encodings between the client and server. It can happen with
ISO-2022-CN
and
ISO-2022-CN-ext
.
var b = decoder.decoding;
| 规范 | 状态 | 注释 |
|---|---|---|
|
编码
The definition of 'TextDecoder.encoding' in that specification. |
实时标准 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
encoding
|
Chrome 38 | Edge ≤79 |
Firefox
19
|
IE 不支持 No | Opera 25 | Safari 10.1 | WebView Android 38 | Chrome Android 38 |
Firefox Android
19
|
Opera Android Yes | Safari iOS 10.3 | Samsung Internet Android 3.0 |
完整支持
不支持
见实现注意事项。
TextDecoder
interface it belongs to.
TextDecoder
encoding