convertUtf16StringToUtf8#
Fully qualified name: carb::extras::convertUtf16StringToUtf8
Defined in carb/extras/Utf8Parser.h
- inline size_t carb::extras::convertUtf16StringToUtf8(
- const char16_t *str,
- char *out,
- size_t outLen,
Convert a UTF-16 encoded string to UTF-8.
- Parameters:
str – [in] The input UTF-16 string to convert. This may not be
nullptr.out – [out] The output buffer to hold the UTF-8 data. This must be at least
outLenbytes in length. This can benullptrto calculate the required output buffer length. The output string written tooutwill always be null terminated (unlessoutLenis 0), even if the string had to be truncated.outLen – [in] The length of
out, in bytes. This should be 0 ifoutisnullptr.
- Returns:
If
outis notnullptr, this returns the number of UTF-8 bytes written toout. This includes the null terminating character.- Returns:
If
outisnullptr, this returns the required buffer length to store the output string.