convertWideStringToUtf8#
Fully qualified name: carb::extras::convertWideStringToUtf8
Defined in carb/extras/Utf8Parser.h
- inline size_t carb::extras::convertWideStringToUtf8(
- cpp::wstring_view str,
- char *out,
- size_t outLen,
Convert a wide string (UTF-16 or UTF-32) to UTF-8 string.
Note
This is provided for interoperability with older systems that still use wide strings. Please use UTF-8, UTF-16 or UTF-32 for new systems.
- Parameters:
str – [in] The input wide string to convert to UTF-8.
out – [out] The output buffer to hold the wide data. This must be at least
outLenin length, in elements. 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 elements. This should be 1 ifoutisnullptr.
- Returns:
If
outis notnullptr, this returns the number of wide characters written toout. This includes the null terminating character.- Returns:
If
outisnullptr, this returns the required buffer length to store the output string.