Skip to main content
Glama
encoding.md1.29 kB
--- title: Encoding description: Standard TextEncoder and TextDecoder APIs available on all Expo-supported platforms. sourceCodeUrl: https://github.com/expo/expo/tree/sdk-52/packages/expo packageName: expo platforms: ["android", "ios", "web", "tvos"] --- The standard URL API is available on all Expo-supported platforms. ## Installation This API is part of the `expo` package. Refer to the [browser and server runtime support](https://caniuse.com/textencoder) for web and Node.js. ## Usage `TextEncoder` and `TextDecoder` are available globally without any need to import them. ```js // [104, 101, 108, 108, 111] const hello = new TextEncoder().encode('hello'); // "hello" const text = new TextDecoder().decode(hello); ``` ## TextEncoder The `TextEncoder` API is included in the Hermes engine. See the [source code in TextEncoder.cpp inside the Hermes GitHub repository](https://github.com/facebook/hermes/blob/9e2bbf8eda15936ee00aee4f8e024ceaa7cd800d/lib/VM/JSLib/TextEncoder.cpp#L1). ## TextDecoder The `TextDecoder` API is not [spec-compliant](https://encoding.spec.whatwg.org/#textdecoder) on native platforms. Only the UTF-8 encoding is supported. If you need support for more encodings, use a polyfill like [`text-encoding`](https://www.npmjs.com/package/text-encoding).

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jaksm/expo-docs-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server