Defined in carb/extras/Utf8Parser.h

inline size_t carb::extras::convertUtf32StringToUtf8(const char32_t *str, char *out, size_t outLen)

Convert a UTF-32 encoded string to UTF-8.

  • str[in] The input UTF-32 string to convert. This may not be nullptr.

  • out[out] The output buffer to hold the UTF-8 data. This must be at least outLen bytes in length. This can be nullptr to calculate the required output buffer length. The output string written to out will always be null terminated (unless outLen is 0), even if the string had to be truncated.

  • outLen[in] The length of out, in bytes. This should be 0 if out is nullptr.


If out is not nullptr, this returns the number of UTF-8 bytes written to out. This includes the null terminating character.


If out is nullptr, this returns the required buffer length to store the output string.