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
.
Interfaces
Specifications
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 |
TextDecoderStream |
71 |
79 |
105 |
No |
58 |
14.1 |
71 |
71 |
105 |
50 |
14.5 |
10.0 |
Encoding_API |
71 |
79 |
105 |
No |
58 |
14.1 |
71 |
71 |
105 |
50 |
14.5 |
10.0 |
encoding |
71 |
79 |
105 |
No |
58 |
14.1 |
71 |
71 |
105 |
50 |
14.5 |
10.0 |
fatal |
71 |
79 |
105 |
No |
58 |
14.1 |
71 |
71 |
105 |
50 |
14.5 |
10.0 |
ignoreBOM |
71 |
79 |
105 |
No |
58 |
14.1 |
71 |
71 |
105 |
50 |
14.5 |
10.0 |
readable |
71 |
79 |
105 |
No |
58 |
14.1 |
71 |
71 |
105 |
50 |
14.5 |
10.0 |
writable |
71 |
79 |
105 |
No |
58 |
14.1 |
71 |
71 |
105 |
50 |
14.5 |
10.0 |
|
Desktop |
Mobile |
|
Chrome |
Edge |
Firefox |
Internet Explorer |
Opera |
Safari |
WebView Android |
Chrome Android |
Firefox for Android |
Opera Android |
Safari on IOS |
Samsung Internet |
TextEncoderStream |
71 |
79 |
105 |
No |
58 |
14.1 |
71 |
71 |
105 |
50 |
14.5 |
10.0 |
Encoding_API |
71 |
79 |
105 |
No |
58 |
14.1 |
71 |
71 |
105 |
50 |
14.5 |
10.0 |
encoding |
71 |
79 |
105 |
No |
58 |
14.1 |
71 |
71 |
105 |
50 |
14.5 |
10.0 |
readable |
71 |
79 |
105 |
No |
58 |
14.1 |
71 |
71 |
105 |
50 |
14.5 |
10.0 |
writable |
71 |
79 |
105 |
No |
58 |
14.1 |
71 |
71 |
105 |
50 |
14.5 |
10.0 |
|
Desktop |
Mobile |
|
Chrome |
Edge |
Firefox |
Internet Explorer |
Opera |
Safari |
WebView Android |
Chrome Android |
Firefox for Android |
Opera Android |
Safari on IOS |
Samsung Internet |
TextEncoder |
38 |
79 |
18 |
No |
25 |
10.1 |
38 |
38 |
18 |
25 |
10.3 |
3.0 |
Encoding_API |
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 |
TextDecoder |
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 |
Encoding_API |
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 |
decode |
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 |
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 |
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 |
api.TextDecoder
BCD tables only load in the browser
api.TextEncoder
BCD tables only load in the browser
api.TextEncoderStream
BCD tables only load in the browser
api.TextDecoderStream
BCD tables only load in the browser
See also
-
Encoding API Encodings - Encodings that must be supported for decoding text.
- A polyfill allowing to use this interface in browsers that don't support it