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

@@ -113,10 +113,9 @@ bool FileBase::ReadAllText(const StringView& path, String& data)
}
// Convert to UTF-16
auto utf16Data = (Char*)Allocator::Allocate(count * sizeof(Char));
uint32 utf16Length;
StringUtils::ConvertUTF82UTF16(reinterpret_cast<char*>(bytes.Get()), utf16Data, count, &utf16Length);
data = utf16Data;
int32 utf16Length;
Char* utf16Data = StringUtils::ConvertUTF82UTF16(reinterpret_cast<char*>(bytes.Get()), count, utf16Length);
data.Set(utf16Data, utf16Length);
Allocator::Free(utf16Data);
}
break;