Cyclone Scheme  0.28.0

◆ Cyc_utf8_encode()

int Cyc_utf8_encode ( char *  dest,
int  sz,
uint32_t *  src,
int  srcsz 
)

This function takes one or more 32-bit chars and encodes them as an array of UTF-8 bytes. FROM: https://www.cprogramming.com/tutorial/utf8.c

Parameters
destDestination byte buffer
szsize of dest buffer in bytes
srcBuffer of source data, in 32-bit characters
srcsznumber of source characters, or -1 if 0-terminated
Returns
Number of characters converted

dest will only be '\0'-terminated if there is enough space. this is for consistency; imagine there are 2 bytes of space left, but the next character requires 3 bytes. in this case we could NUL-terminate, but in general we can't when there's insufficient space. therefore this function only NUL-terminates if all the characters fit, and there's space for the NUL as well. the destination string will never be bigger than the source string.