Kit
Variables

getUtf8Encoder

const getUtf8Encoder: () => VariableSizeEncoder<string>

Returns an encoder for UTF-8 strings.

This encoder serializes strings using UTF-8 encoding. The encoded output contains as many bytes as needed to represent the string.

For more details, see getUtf8Codec.

Returns

VariableSizeEncoder<string>

A VariableSizeEncoder<string> for encoding UTF-8 strings.

Example

Encoding a UTF-8 string.

const encoder = getUtf8Encoder();
const bytes = encoder.encode('hello'); // 0x68656c6c6f

See

getUtf8Codec

On this page