Encoding API

This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for the proper prefixes to use in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the spec changes.

The Encoding API defines allows to deal with text encoded with different methods. It mainly allows to handle legacy content, encrypted with old methods, as it requires new content to be encoded using UTF-8.

It provides two interfaces: a decoding interface, TextDecoder, allowing to decode texts encoded with a wide range a method; and an encoding interface TextEncoder allowing to encode string with recommended methods only.



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.


Specification Status Comment
Encoding Living Standard Initial definitions.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support


19.0 (19.0) Not supported 25 Not supported
Feature Android Android Webview Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile Chrome for Android
Basic support Not supported


19.0 (19.0) Not supported ? Not supported




© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.

API Reference Référence