Merge pull request #289 from kichikuou/dap-output

debugger_dap: Fix garbled characters in output events on Windows
This commit is contained in:
Nunuhara Cabbage
2025-10-10 18:42:38 -07:00
committed by GitHub
+7
View File
@@ -1087,6 +1087,13 @@ void dbg_dap_log(const char *log, const char *fmt, va_list ap)
size_t len = max(1024, strlen(fmt) * 2);
char *buf = xmalloc(len);
vsnprintf(buf, len, fmt, ap);
#ifdef _WIN32
// Since the callers use display_sjis*(), buf is in Shift_JIS on Windows.
// Convert to UTF-8 for DAP.
char *utf8 = sjis2utf(buf, 0);
free(buf);
buf = utf8;
#endif
emit_output_event(log, buf);
free(buf);
}