diff src/debug.cpp @ 20699:d198fbc52efc draft

-Fix: [Win32] The console code page for non-Unicode builds is not the normal ANSI code page and definitely not UTF-8 either.
author Michael Lutz <michi@icosahedron.de>
date Thu, 28 Mar 2013 02:41:43 +0100 (2013-03-28)
parents 9bb2cce59004
children
line wrap: on
line diff
--- a/src/debug.cpp
+++ b/src/debug.cpp
@@ -131,13 +131,14 @@
 		fflush(f);
 #endif
 	} else {
+		char buffer[512];
+		seprintf(buffer, lastof(buffer), "%sdbg: [%s] %s\n", GetLogPrefix(), dbg, buf);
 #if defined(WINCE)
-		/* We need to do OTTD2FS twice, but as it uses a static buffer, we need to store one temporary */
-		TCHAR tbuf[512];
-		_sntprintf(tbuf, sizeof(tbuf), _T("%s"), OTTD2FS(dbg));
-		NKDbgPrintfW(_T("dbg: [%s] %s\n"), tbuf, OTTD2FS(buf));
+		NKDbgPrintfW(OTTD2FS(buffer));
+#elif defined(WIN32) || defined(WIN64)
+		_fputts(OTTD2FS(buffer, true), stderr);
 #else
-		fprintf(stderr, "%sdbg: [%s] %s\n", GetLogPrefix(), dbg, buf);
+		fputs(buffer, stderr);
 #endif
 #ifdef ENABLE_NETWORK
 		NetworkAdminConsole(dbg, buf);