From 9f011cb572e188cccc74008e47be20a700d61ac7 Mon Sep 17 00:00:00 2001 From: lordmulder Date: Tue, 27 Sep 2011 21:32:45 +0200 Subject: [PATCH] Also repair 'cout' and 'cerr' to not mangle UTF-8 strings. --- etc/Translation/Blank.ts | 6 +++--- src/Config.h | 2 +- src/Global.cpp | 10 ++++++---- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/etc/Translation/Blank.ts b/etc/Translation/Blank.ts index dbcdc0b1..20a69697 100644 --- a/etc/Translation/Blank.ts +++ b/etc/Translation/Blank.ts @@ -2684,17 +2684,17 @@ QApplication - + Executable '%1' doesn't support Windows compatibility mode. - + Executable '%1' requires Qt v%2, but found Qt v%3. - + Executable '%1' requires Windows 2000 or later. diff --git a/src/Config.h b/src/Config.h index e906f76b..63726dde 100644 --- a/src/Config.h +++ b/src/Config.h @@ -30,7 +30,7 @@ #define VER_LAMEXP_MINOR_LO 3 #define VER_LAMEXP_TYPE Beta #define VER_LAMEXP_PATCH 2 -#define VER_LAMEXP_BUILD 699 +#define VER_LAMEXP_BUILD 700 /////////////////////////////////////////////////////////////////////////////// // Tools versions diff --git a/src/Global.cpp b/src/Global.cpp index aa19d3d1..2274cc3f 100644 --- a/src/Global.cpp +++ b/src/Global.cpp @@ -49,6 +49,8 @@ #include "LockedFile.h" //CRT includes +#include +#include #include #include #include @@ -492,10 +494,10 @@ void lamexp_init_console(int argc, char* argv[]) const int flags = _O_WRONLY | _O_U8TEXT; int hCrtStdOut = _open_osfhandle((intptr_t) GetStdHandle(STD_OUTPUT_HANDLE), flags); int hCrtStdErr = _open_osfhandle((intptr_t) GetStdHandle(STD_ERROR_HANDLE), flags); - FILE *hfStdOut = (hCrtStdOut >= 0) ? _fdopen(hCrtStdOut, "w") : NULL; - FILE *hfStderr = (hCrtStdErr >= 0) ? _fdopen(hCrtStdErr, "w") : NULL; - if(hfStdOut) *stdout = *hfStdOut; - if(hfStderr) *stderr = *hfStderr; + FILE *hfStdOut = (hCrtStdOut >= 0) ? _fdopen(hCrtStdOut, "wb") : NULL; + FILE *hfStdErr = (hCrtStdErr >= 0) ? _fdopen(hCrtStdErr, "wb") : NULL; + if(hfStdOut) { *stdout = *hfStdOut; std::cout.rdbuf(new std::filebuf(hfStdOut)); } + if(hfStdErr) { *stderr = *hfStdErr; std::cerr.rdbuf(new std::filebuf(hfStdErr)); } } HWND hwndConsole = GetConsoleWindow();