This is an experimental technologyCheck the Browser compatibility table carefully before using this in production.
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
Tutorials & tools
- A shim allowing to use this interface in browsers that don't support it.
StringView
– a C-like representation of strings based on typed arrays.
Specifications
Specification | Status | Comment |
Encoding | Living Standard | Initial definition. |
Browser compatibility
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
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
TextDecoder
|
Chrome
Full support 38 |
Edge
Full support ≤79 |
Firefox Full support 19 Full support 19 Partial support 18 Notes' Implemented a slightly different version of the spec. |
IE
No support No |
Opera
Full support 25 |
Safari
Full support 10.1 |
WebView Android
Full support 38 |
Chrome Android
Full support 38 |
Firefox Android Full support 19 Full support 19 Partial support 18 Notes' Implemented a slightly different version of the spec. |
Opera Android
Full support Yes |
Safari iOS
Full support 10.3 |
Samsung Internet Android
Full support 3.0 |
TextDecoder() constructor
|
Chrome
Full support 38 |
Edge
Full support ≤79 |
Firefox Full support 19 Full support 19 Partial support 18 Notes' Implemented a slightly different version of the spec. |
IE
No support No |
Opera
Full support 25 |
Safari
Full support 10.1 |
WebView Android
Full support 38 |
Chrome Android
Full support 38 |
Firefox Android Full support 19 Full support 19 Partial support 18 Notes' Implemented a slightly different version of the spec. |
Opera Android
? |
Safari iOS
Full support 10.3 |
Samsung Internet Android
Full support 3.0 |
decode
|
Chrome
Full support 38 |
Edge
Full support ≤79 |
Firefox Full support 19 Full support 19 Partial support 18 Notes' Implemented a slightly different version of the spec. |
IE
No support No |
Opera
Full support 25 |
Safari
Full support 10.1 |
WebView Android
Full support 38 |
Chrome Android
Full support 38 |
Firefox Android Full support 19 Full support 19 Partial support 18 Notes' Implemented a slightly different version of the spec. |
Opera Android
Full support Yes |
Safari iOS
Full support 10.3 |
Samsung Internet Android
Full support 3.0 |
encoding
|
Chrome
Full support 38 |
Edge
Full support ≤79 |
Firefox Full support 19 Full support 19 Partial support 18 Notes' Implemented a slightly different version of the spec. |
IE
No support No |
Opera
Full support 25 |
Safari
Full support 10.1 |
WebView Android
Full support 38 |
Chrome Android
Full support 38 |
Firefox Android Full support 19 Full support 19 Partial support 18 Notes' Implemented a slightly different version of the spec. |
Opera Android
Full support Yes |
Safari iOS
Full support 10.3 |
Samsung Internet Android
Full support 3.0 |
fatal
|
Chrome
Full support Yes |
Edge
Full support ≤79 |
Firefox
Full support Yes |
IE
No support No |
Opera
Full support Yes |
Safari
Full support 10.1 |
WebView Android
Full support Yes |
Chrome Android
Full support Yes |
Firefox Android
Full support Yes |
Opera Android
Full support Yes |
Safari iOS
Full support 10.3 |
Samsung Internet Android
Full support Yes |
ignoreBOM
|
Chrome
Full support Yes |
Edge
Full support ≤79 |
Firefox
Full support Yes |
IE
No support No |
Opera
Full support Yes |
Safari
Full support 10.1 |
WebView Android
Full support Yes |
Chrome Android
Full support Yes |
Firefox Android
Full support Yes |
Opera Android
Full support Yes |
Safari iOS
Full support 10.3 |
Samsung Internet Android
Full support Yes |
Available in workers | Chrome
Full support 38 |
Edge
Full support ≤79 |
Firefox
Full support 20 |
IE
No support No |
Opera
Full support 25 |
Safari
Full support 10.1 |
WebView Android
Full support 38 |
Chrome Android
Full support 38 |
Firefox Android
Full support 20 |
Opera Android
? |
Safari iOS
Full support 10.3 |
Samsung Internet Android
Full support 3.0 |
Legend
- Full support
- Full support
- No support
- No support
- Compatibility unknown
- Compatibility unknown
- See implementation notes.'
- See implementation notes.
TextEncoder
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome
Full support 38 |
Edge
Full support 79 |
Firefox Full support 19 Full support 19 Full support 18 Notes' Firefox 18 implemented an earlier and slightly different version of the specification. |
IE
No support No |
Opera
Full support 25 |
Safari
Full support 10.1 |
WebView Android
Full support 38 |
Chrome Android
Full support 38 |
Firefox Android Full support 19 Full support 19 Full support 18 Notes' Firefox 18 implemented an earlier and slightly different version of the specification. |
Opera Android
Full support Yes |
Safari iOS
Full support 10.3 |
Samsung Internet Android
Full support 3.0 | |
Chrome Full support 53 Full support 53 Notes' Does not accept parameters. Supports only Notes' Throws |
Edge Full support 79 Full support 79 Notes' Does not accept parameters. Supports only |
Firefox Full support 48 Full support 48 Notes' The constructor accepts an encoding type label argument, but the value is ignored. Only Notes' If the encoding type label argument is invalid, then a Notes' If the encoding type label argument is invalid, then a Notes' Firefox 18 implemented an earlier and slightly different version of the specification. |
IE
No support No |
Opera
Full support 25 |
Safari
Full support 10.1 |
WebView Android
Full support 38 |
Chrome Android
Full support 38 |
Firefox Android Full support 48 Full support 48 Notes' The constructor accepts an encoding type label argument, but the value is ignored. Only Notes' If the encoding type label argument is invalid, then a Notes' If the encoding type label argument is invalid, then a Notes' Firefox 18 implemented an earlier and slightly different version of the specification. |
Opera Android
? |
Safari iOS
Full support 10.3 |
Samsung Internet Android
Full support 3.0 | |
Chrome
Full support 38 |
Edge
Full support 79 |
Firefox Full support 19 Full support 19 Full support 18 Notes' Firefox 18 implemented an earlier and slightly different version of the specification. |
IE
No support No |
Opera
Full support 25 |
Safari
Full support 10.1 |
WebView Android
Full support 38 |
Chrome Android
Full support 38 |
Firefox Android Full support 19 Full support 19 Full support 18 Notes' Firefox 18 implemented an earlier and slightly different version of the specification. |
Opera Android
Full support Yes |
Safari iOS
Full support 10.3 |
Samsung Internet Android
Full support 3.0 | |
Chrome
Full support 74 |
Edge
Full support 79 |
Firefox
Full support 66 |
IE
No support No |
Opera
No support No |
Safari
No support No |
WebView Android
Full support 74 |
Chrome Android
Full support 74 |
Firefox Android
Full support 66 |
Opera Android
No support No |
Safari iOS
No support No |
Samsung Internet Android
Full support 11.0 | |
Chrome
Full support 38 |
Edge
Full support 79 |
Firefox Full support 19 Full support 19 Full support 18 Notes' Firefox 18 implemented an earlier and slightly different version of the specification. |
IE
No support No |
Opera
Full support 25 |
Safari
Full support 10.1 |
WebView Android
Full support 38 |
Chrome Android
Full support 38 |
Firefox Android Full support 19 Full support 19 Full support 18 Notes' Firefox 18 implemented an earlier and slightly different version of the specification. |
Opera Android
Full support Yes |
Safari iOS
Full support 10.3 |
Samsung Internet Android
Full support 3.0 | |
Available in workers |
Chrome
Full support 38 |
Edge
Full support 79 |
Firefox
Full support 20 |
IE
No support No |
Opera
Full support 25 |
Safari
Full support 10.1 |
WebView Android
Full support 38 |
Chrome Android
Full support 38 |
Firefox Android
Full support 20 |
Opera Android
? |
Safari iOS
Full support 10.3 |
Samsung Internet Android
Full support 3.0 |
Legend
- Full support
- Full support
- No support
- No support
- Compatibility unknown
- Compatibility unknown
- Experimental. Expect behavior to change in the future.'
- Experimental. Expect behavior to change in the future.
- See implementation notes.'
- See implementation notes.
Encoding API by Mozilla Contributors is licensed under CC-BY-SA 2.5.