We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ed3fc3e commit 1fe29a6Copy full SHA for 1fe29a6
1 file changed
engine/system/win/sys_console.cpp
@@ -298,7 +298,16 @@ void sys_console_c::Print(std::u32string_view string_view_text)
298
b+= escLen - 1;
299
} else {
300
// Add character
301
- *(p++) = (char16_t)text[b];
+ if (text[b] > INT16_MAX) { // Outside the BMP
302
+ char16_t high_surrogate = ((text[b] - 0x10000) >> 10) + 0xD800;
303
+ char16_t low_surrogate = ((text[b] - 0x10000) << 10) + 0xDC00;
304
+ *(p++) = high_surrogate;
305
+ *(p++) = low_surrogate;
306
+ }
307
+ else {
308
+ *(p++) = (char16_t)text[b];
309
310
+
311
}
312
313
winText[len] = 0;
0 commit comments