carb::extras::convertUtf8StringToWide
Defined in carb/extras/Utf8Parser.h
-
inline size_t carb::extras::convertUtf8StringToWide(const char *str, wchar_t *out, size_t outLen) noexcept
Convert a UTF-8 encoded string to wide string.
Note
This is provided for interoperability with older systems that still use wide strings. Please use UTF-8 or UTF-32 for new systems.
- Parameters
str – [in] The input UTF-8 string to convert. This may not be
nullptr
.out – [out] The output buffer to hold the wide data. This must be at least
outLen
in length, in elements. This can benullptr
to calculate the required output buffer length. The output string written toout
will always be null terminated (unlessoutLen
is 0), even if the string had to be truncated.outLen – [in] The length of
out
, in elements. This should be 1 ifout
isnullptr
.
- Returns
If
out
is notnullptr
, this returns the number of wide characters written toout
. This includes the null terminating character.- Returns
If
out
isnullptr
, this returns the required buffer length to store the output string.