Marmos
v juptune
v asn1
v lang
v ast
v Classes
v Enums
v ir
v parser
v Enums
v Structs
v core
v crypto
v keyexchange
v memory
v data
v alphabet
v buffer
v json
v builder
v parser
v Enums
v Structs
v serialise
v Structs
v Templates
v pem
v Enums
v Structs

Functions utf8Encode

1
2
3
4
5
6
7
module juptune.data.utf8;

Result utf8Encode(
    dchar ch, 
    ubyte[4LU] buffer, 
    ubyte[] outSlice
);

Documentation

Encodes (but does not validate) the given Unicode codepoint into UTF-8 codeunits.

Notes

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.

Params

Throws

Utf8Error.invalidif chis greater than 0x10FFFF - as any value above that number is not allowed to be encoded under UTF-8.

Returns

A Resultindicating whether encoding was succesful or not.