docs.rodeo

MDN Web Docs mirror

Encoding API

{{DefaultAPISidebar("Encoding API")}} {{AvailableInWorkers}} 

The Encoding API enables web developers to work with text that is represented in {{Glossary("character encoding", "character encodings")}}  systems other than the encoding used internally by JavaScript strings. In particular, it enables developers to convert text between JavaScript strings and the {{glossary("UTF-8")}}  encoding that is used for most documents on the web.

It provides two mechanisms:

Note that these operations are asymmetrical: encoding only encodes to UTF-8, while decoding can decode UTF-8 but also many legacy encoding systems.

The API provides synchronous interfaces for encoding and decoding, and also stream-based encoders and decoders, which could be used to, for example, decode text as it arrives over a network connection.

Interfaces

Specifications

{{Specifications}} 

Browser compatibility

{{Compat}} 

See also

In this article

View on MDN