diff --git a/Common/Misc.cpp b/Common/Misc.cpp index f5393cc1f9..5f80745b83 100644 --- a/Common/Misc.cpp +++ b/Common/Misc.cpp @@ -15,6 +15,7 @@ // Official SVN repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ +#include "util/text/utf8.h" #include "Common.h" #include @@ -44,14 +45,17 @@ const char *GetLastErrorMsg() } const char *GetStringErrorMsg(int errCode) { - static const size_t buff_size = 255; + static const size_t buff_size = 1023; #ifndef _XBOX #ifdef _WIN32 - static __declspec(thread) char err_str[buff_size] = {}; + static __declspec(thread) wchar_t err_strw[buff_size] = {}; - FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, errCode, + FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, errCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - err_str, buff_size, NULL); + err_strw, buff_size, NULL); + + static __declspec(thread) char err_str[buff_size] = {}; + snprintf(err_str, buff_size, ConvertWStringToUTF8(err_strw).c_str()); #else static __thread char err_str[buff_size] = {};