Fix StringUtils::ConvertANSI2UTF16 to properly handle multi-byte characters Length

#1225
This commit is contained in:
Wojtek Figat
2023-07-03 12:10:06 +02:00
parent 9a1fd12a85
commit 9d640656e6
9 changed files with 26 additions and 19 deletions

View File

@@ -179,10 +179,12 @@ const char* StringUtils::Find(const char* str, const char* toFind)
return strstr(str, toFind);
}
void StringUtils::ConvertANSI2UTF16(const char* from, Char* to, int32 len)
void StringUtils::ConvertANSI2UTF16(const char* from, Char* to, int32 fromLength, int32& toLength)
{
if (len)
mbstowcs(to, from, len);
if (fromLength)
toLength = mbstowcs(to, from, fromLength);
else
toLength = 0;
}
void StringUtils::ConvertUTF162ANSI(const Char* from, char* to, int32 len)