Fix UTF-8 and UTF-16 encoding support usage in Json resources

Closes #310
Closes #27
This commit is contained in:
Wojtek Figat
2021-03-07 21:30:01 +01:00
parent 400cc97100
commit 77b21de534
16 changed files with 186 additions and 167 deletions

View File

@@ -81,9 +81,8 @@ void UICanvas::Serialize(SerializeStream& stream, const void* otherObj)
else
{
// Write result data
auto length = mono_string_length(invokeResultStr);
auto invokeResultChars = mono_string_to_utf8(invokeResultStr);
stream.RawValue(invokeResultChars, length);
stream.RawValue(invokeResultChars);
mono_free(invokeResultChars);
}
}

View File

@@ -99,14 +99,13 @@ void UIControl::Serialize(SerializeStream& stream, const void* otherObj)
{
stream.JKEY("Control");
const auto controlTypeChars = mono_string_to_utf8(controlType);
stream.String(controlTypeChars, controlTypeLength);
stream.String(controlTypeChars);
mono_free(controlTypeChars);
}
stream.JKEY("Data");
const auto invokeResultLength = mono_string_length(invokeResultStr);
const auto invokeResultChars = mono_string_to_utf8(invokeResultStr);
stream.RawValue(invokeResultChars, invokeResultLength);
stream.RawValue(invokeResultChars);
mono_free(invokeResultChars);
}