From 56392cc02f849e0f2e3bc17557dad2f116590d4a Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Sat, 22 Sep 2018 12:50:23 +0200 Subject: [PATCH] Update MMDPmxParser.cpp Fix encoding for readstrings. --- code/MMDPmxParser.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/MMDPmxParser.cpp b/code/MMDPmxParser.cpp index 355ef2146..2c5bd9a8d 100644 --- a/code/MMDPmxParser.cpp +++ b/code/MMDPmxParser.cpp @@ -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