Encodes the string as UTF-8 bytes.
encode(string)
string
The string to encode.
A Uint8Array of bytes.
utf8.encode("hello 🐥")
Uint8Array [104, 101, 108, 108, 111, 32, 240, 159, 144, 165]
// same as
new TextEncoder().encode("hello 🐥")
Uint8Array [104, 101, 108, 108, 111, 32, 240, 159, 144, 165]