Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/simple_utility/src/text.ts>utfEncode

Useful snippet collection.
Go to Latest
function utfEncode
import { utfEncode } from "https://deno.land/x/simple_utility@v1.3.0/src/text.ts";

Convert from string to UTF-8 binary.

Examples

Example 1

const text = "HelloWorld!";
const converted = utfEncode(text);
const restored = utfDecode(converted);

Parameters

data: string

Returns

Uint8Array