Author: manx
Date: Tue Jun 25 15:09:37 2024
New Revision: 21056
URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21056
Log:
[Fix] mpt/string_transcode/transcode.hpp: When converting to UTF16 from UTF32 or UTF8 and encountering a Unicode codepoint outside of official range, do not output a \0 character after the replacement character.
Modified:
trunk/OpenMPT/src/mpt/string_transcode/transcode.hpp
Modified: trunk/OpenMPT/src/mpt/string_transcode/transcode.hpp
==============================================================================
--- trunk/OpenMPT/src/mpt/string_transcode/transcode.hpp Sun Jun 23 14:05:01 2024 (r21055)
+++ trunk/OpenMPT/src/mpt/string_transcode/transcode.hpp Tue Jun 25 15:09:37 2024 (r21056)
@@ -678,6 +678,7 @@
out.push_back(replacement);
ucs4 = 0;
charsleft = 0;
+ continue;
}
if (ucs4 <= 0xffff) {
out.push_back(static_cast<mpt::widechar>(ucs4));
@@ -817,7 +818,7 @@
char32_t ucs4 = static_cast<char32_t>(static_cast<uint32>(in[i]));
if (ucs4 > 0x1fffff) {
out.push_back(static_cast<typename Tdststring::value_type>(static_cast<uint16>(replacement)));
- ucs4 = 0;
+ continue;
}
if (ucs4 <= 0xffff) {
out.push_back(static_cast<typename Tdststring::value_type>(static_cast<uint16>(ucs4)));
|