utf8Encode

fnsize_t utf8Encode(dchar d, ref ubyte[4] outBuf) @safe nothrow @nogc

Encode a single Unicode code point d to UTF-8 into outBuf.

Returns the number of bytes written (1..4). Intended for internal use by percent-encoding helpers.

Parameters

dCode point to encode.
outBufOutput buffer that receives 1–4 UTF-8 bytes.

Returns

The number of bytes written to outBuf.