The TextDecoder.encoding
read-only property returns a string containing the name of the decoding algorithm used by the specific decoder object.
The encoding is set by the constructor label
parameter, and defaults to utf-8
.
The TextDecoder.encoding
read-only property returns a string containing the name of the decoding algorithm used by the specific decoder object.
The encoding is set by the constructor label
parameter, and defaults to utf-8
.
A lower-cased ASCII string, which can be one of the following values:
'utf-8'
.'x-user-defined'
. 'replacement'
. This decodes empty input into empty output and any other arbitrary-length input into a single replacement character. It is used to prevent attacks that mismatch encodings between the client and server. The following encodings also map to the replacement encoding: ISO-2022-CN
, ISO-2022-CN-ext
, 'iso-2022-kr', and 'hz-gb-2312'. Specification |
---|
Encoding Standard # ref-for-dom-textdecoder-encoding① |
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
encoding |
38 | 79 | 1918Implemented a slightly different version of the spec. |
No | 25 | 10.1 | 38 | 38 | 1918Implemented a slightly different version of the spec. |
25 | 10.3 | 3.0 |
TextDecoder
interface it belongs to.
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder/encoding