1234567module juptune.data.utf8;
Result utf8Encode(
dchar ch,
ubyte[4LU] buffer,
ubyte[] outSlice
);
Encodes (but does not validate) the given Unicode codepoint into UTF-8 codeunits.
This function does not validate that chis a valid codepoint. It is up to the caller the use the other validation functions when appropriate to confirm the encoding is valid.
For buffer, just initialise an empty Utf8EncodeCharBufferand pass it in - it's just to make handling the variable-lengthiness of UTF-8 easier.
Utf8Error.invalidif chis greater than 0x10FFFF - as any value above that number is not allowed to be encoded under UTF-8.
A Resultindicating whether encoding was succesful or not.