summaryrefslogtreecommitdiffstats
path: root/src/winconsole.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/winconsole.cpp')
-rw-r--r--src/winconsole.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/winconsole.cpp b/src/winconsole.cpp
index 085fb441c..f91b19c5c 100644
--- a/src/winconsole.cpp
+++ b/src/winconsole.cpp
@@ -100,6 +100,11 @@ int main()
// it guarantees perfect behavior w.r.t. quoting
WCHAR *cmd = GetCommandLineW();
+ // temporarily switch console encoding to UTF8 while the spwaned process runs
+ // as everything else is a mess and it seems to work just fine
+ const unsigned int initial_cp = GetConsoleOutputCP();
+ SetConsoleOutputCP(CP_UTF8);
+
// set up the pipes and handles
stdin.echo_read = GetStdHandle(STD_INPUT_HANDLE);
stdout.echo_write = GetStdHandle(STD_OUTPUT_HANDLE);
@@ -148,6 +153,9 @@ int main()
// wait until the standard output thread terminates
WaitForSingleObject(stdout_thread, INFINITE);
+ // switch back to initial console encoding
+ SetConsoleOutputCP(initial_cp);
+
return 0;
}