Encoding API

Note: This feature is available in Web Workers.

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

Specification
Encoding Standard
# interface-textdecoder
Encoding Standard
# interface-textencoder
Encoding Standard
# interface-textencoderstream
Encoding Standard
# interface-textdecoderstream

Browser compatibility

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