From 1e682bad09661cd0f791e6a623e9f10852de4094 Mon Sep 17 00:00:00 2001 From: kichikuou Date: Sat, 11 Oct 2025 09:49:16 +0900 Subject: [PATCH] debugger_dap: Fix garbled characters in output events on Windows --- src/debugger_dap.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/debugger_dap.c b/src/debugger_dap.c index 92828c7..053ebf5 100644 --- a/src/debugger_dap.c +++ b/src/debugger_dap.c @@ -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); }