Doc: https://www.stablelib.com/functions/_stablelib_utf8.encode.html
Encodes the given string into UTF-8 byte array. Throws if the source string has invalid UTF-16 encoding.
Contrary to the documentation, it doesn't work
> require('@stablelib/utf8').encode('\ud800') // ok
Uncaught Error: utf8: invalid string
> require('@stablelib/utf8').encode('\udfff') // fail
Uint8Array(3) [ 237, 191, 191 ]
> '\udfff'.isWellFormed()
false