From eb15711ee68f15a48747820bd0639a711c767557 Mon Sep 17 00:00:00 2001 From: Tobias Date: Fri, 7 Dec 2018 16:21:18 +0100 Subject: [PATCH] Backport review comment from citra-emu/citra#4418 Original reason: As Windows multi-byte character codec is unspecified while we always assume std::string uses UTF-8 in our code base, this can output gibberish when the string contains non-ASCII characters. ::OutputDebugStringW combined with Common::UTF8ToUTF16W is preferred here. --- src/common/logging/backend.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp index 5753b871a7..12f6d01144 100644 --- a/src/common/logging/backend.cpp +++ b/src/common/logging/backend.cpp @@ -13,7 +13,7 @@ #include #ifdef _WIN32 #include // For _SH_DENYWR -#include // For OutputDebugStringA +#include // For OutputDebugStringW #else #define _SH_DENYWR 0 #endif @@ -148,7 +148,7 @@ void FileBackend::Write(const Entry& entry) { void DebuggerBackend::Write(const Entry& entry) { #ifdef _WIN32 - ::OutputDebugStringA(FormatLogMessage(entry).append(1, '\n').c_str()); + ::OutputDebugStringW(Common::UTF8ToUTF16W(FormatLogMessage(entry).append(1, '\n')).c_str()); #endif }