Skip to content
Browse files

[win32] Fix incorrect debug output on non-ASCII system

  • Loading branch information...
1 parent cb8adaa commit 6c762ec72ea4b0aa1f0da285ce01d8d93cba1979 @Karlson2k committed Aug 17, 2012
Showing with 12 additions and 1 deletion.
  1. +12 −1 xbmc/utils/log.cpp
View
13 xbmc/utils/log.cpp
@@ -213,7 +213,18 @@ int CLog::GetLogLevel()
void CLog::OutputDebugString(const std::string& line)
{
#if defined(_DEBUG) || defined(PROFILE)
- ::OutputDebugString(line.c_str());
+#if defined(TARGET_WINDOWS)
+ // we can't use charsetconverter here as it's initialized later than CLog and deinitialized early
+ int bufSize = MultiByteToWideChar(CP_UTF8, 0, line.c_str(), -1, NULL, 0);
+ CStdStringW wstr (L"", bufSize);
+ if ( MultiByteToWideChar(CP_UTF8, 0, line.c_str(), -1, wstr.GetBuf(bufSize), bufSize) == bufSize )
+ {
+ wstr.RelBuf();
+ ::OutputDebugStringW(wstr.c_str());
+ }
+ else
+#endif // TARGET_WINDOWS
+ ::OutputDebugString(line.c_str());
::OutputDebugString("\n");
#endif
}

0 comments on commit 6c762ec

Please sign in to comment.
Something went wrong with that request. Please try again.