dom / latest / encoding_api.html /

Encoding API

The Encoding 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.

Note: This feature is available in Web Workers

Interfaces

Specifications

Specification Status Comment
Encoding Living Standard Initial definition.

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
Encoding_API
38
79
18
No
25
10.1
38
38
18
25
10.3
3.0
TextEncoder
38
79
18
No
25
10.1
38
38
18
25
10.3
3.0
encode
38
79
18
No
25
10.1
38
38
18
25
10.3
3.0
encodeInto
74
79
66
No
62
14.1
74
74
66
50
14.5
11.0
encoding
38
79
18
No
25
10.1
38
38
18
25
10.3
3.0
worker_support
38
79
20
No
25
10.1
38
38
20
25
10.3
3.0
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
Encoding_API
38
79
19
18
Implemented a slightly different version of the spec.
No
25
10.1
38
38
19
18
Implemented a slightly different version of the spec.
25
10.3
3.0
TextDecoder
38
79
19
18
Implemented a slightly different version of the spec.
No
25
10.1
38
38
19
18
Implemented a slightly different version of the spec.
25
10.3
3.0
decode
38
79
19
18
Implemented a slightly different version of the spec.
No
25
10.1
38
38
19
18
Implemented a slightly different version of the spec.
25
10.3
3.0
encoding
38
79
19
18
Implemented a slightly different version of the spec.
No
25
10.1
38
38
19
18
Implemented a slightly different version of the spec.
25
10.3
3.0
fatal
38
79
36
No
25
10.1
38
38
36
25
10.3
3.0
ignoreBOM
38
79
63
No
25
10.1
38
38
63
25
10.3
3.0
worker_support
38
79
20
No
25
10.1
38
38
20
25
10.3
3.0

TextDecoder

BCD tables only load in the browser

TextEncoder

BCD tables only load in the browser

See also

  • A shim allowing to use this interface in browsers that don't support it

© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Encoding_API