Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Aug 26, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 12 additions & 1 deletion xbmc/utils/log.cpp
Expand Up @@ -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
}