Update MMDPmxParser.cpp

Fix encoding for readstrings.
This commit is contained in:
Kim Kulling
2018-09-22 12:50:23 +02:00
committed by GitHub
parent d42f9a3226
commit 56392cc02f

View File

@@ -96,12 +96,13 @@ namespace pmx
// UTF16 to UTF8
const uint16_t* sourceStart = (uint16_t*)buffer.data();
const unsigned int targetSize = size * 3; // enough to encode
char targetStart[targetSize];
char *targetStart = new char[targetSize];
std::memset(targetStart, 0, targetSize * sizeof(char));
utf8::utf16to8( sourceStart, sourceStart + size/2, targetStart );
std::string result(targetStart);
delete [] targetStart;
return result;
}
else