1
0
mirror of synced 2025-01-18 17:14:13 +01:00

Fixed UTF-8 decoding to not work

This commit is contained in:
WerWolv 2020-11-22 16:22:23 +01:00
parent 8297e22f10
commit 5f025bcbcc

View File

@ -56,11 +56,11 @@ namespace hex {
char buffer[5] = { 0 };
char codepointString[5] = { 0 };
u32 codepoint = 0;
u8 codepointSize = ImTextCharFromUtf8(&codepoint, buffer, buffer + 4);
std::memcpy(buffer, &this->m_previewData.utf8Char, 4);
std::memcpy(codepointString, &codepoint, std::min(codepointSize, u8(4)));
u8 codepointSize = ImTextCharFromUtf8(&codepoint, buffer, buffer + 4);
std::memcpy(codepointString, &codepoint, std::min(codepointSize, u8(4)));
this->m_cachedData.emplace_back("UTF-8 code point", hex::format("'%s' (U+%04lx)", codepoint == 0xFFFD ? "Invalid" : codepointString, codepoint));
}