TextEncoder.encode()

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The TextEncoder.encode() method returns a Uint8Array containing the text given in parameters encoded with the specific method for that TextEncoder object.

Syntax

b1 = encoder.encode(string);

Parameters

string
Is a DOMString containing the text to encode.

Specifications

Specification Status Comment
Encoding
The definition of 'TextEncoder.encode()' in that specification.
Living Standard Initial definition.

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic support
Experimental
Chrome Full support 38Edge ? Firefox Full support 19
Full support 19
Full support 18
Notes
Notes Firefox 18 implemented an earlier and slightly different version of the specification.
IE No support NoOpera Full support 25Safari Full support 10.1WebView Android Full support 38Chrome Android Full support 38Edge Mobile ? Firefox Android Full support 19
Full support 19
Full support 18
Notes
Notes Firefox 18 implemented an earlier and slightly different version of the specification.
Opera Android ? Safari iOS Full support 10.1Samsung Internet Android ?

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.

See also

Document Tags and Contributors

Last updated by: ExE-Boss,