std1.0.0-beta-7 SafeC docs

std :: encoding::utf8

Function std::utf8_encode

#include <std/encoding/utf8.h> source · definition

int utf8_encode(unsigned int cp, &char out)

Encodes 'cp' into 'out' (caller-provided buffer, must have room for at least 4 bytes — UTF-8's longest encoding). Returns the number of bytes written (1-4), or 0 if 'cp' is not a valid Unicode scalar value (> 0x10FFFF or inside the surrogate range 0xD800..0xDFFF).