WIN32: Fix convertEncoding problem due to String deallcation

This commit is contained in:
Zvika Haramaty 2020-05-12 18:04:53 +03:00 committed by Eugene Sandulenko
parent ce11c13ffa
commit a611975561

View File

@ -436,9 +436,11 @@ char *OSystem_Win32::convertEncoding(const char* to, const char *from, const cha
#endif
// UTF-32 is really important for us, because it is used for the
// transliteration in Common::Encoding and Win32 cannot convert it
Common::String tempString;
if (Common::String(from).hasPrefixIgnoreCase("utf-32")) {
Common::U32String UTF32Str((const uint32 *)string, length / 4);
string = Common::convertUtf32ToUtf8(UTF32Str).c_str();
tempString = Common::convertUtf32ToUtf8(UTF32Str);
string = tempString.c_str();
from = "utf-8";
}
if (Common::String(to).hasPrefixIgnoreCase("utf-32")) {