diff options
| author | Eduard Braun <eduard.braun2@gmx.de> | 2017-05-10 00:21:03 +0000 |
|---|---|---|
| committer | Eduard Braun <eduard.braun2@gmx.de> | 2017-05-10 00:21:03 +0000 |
| commit | e1097ab39decf853abbb6a934c47afa841445237 (patch) | |
| tree | 1618542c3b345d610e00852f764eeaee90b1e322 /src/winconsole.cpp | |
| parent | cmake/Windows: convert all 'DESTINATION's to relative paths and allow easy cu... (diff) | |
| download | inkscape-e1097ab39decf853abbb6a934c47afa841445237.tar.gz inkscape-e1097ab39decf853abbb6a934c47afa841445237.zip | |
Use UTF8 encoding for output on windows console.
This avoids the misery and frustration of converting to the overly limited ANSI codepages and does not seem to cause any issues so far.
(bzr r15682)
Diffstat (limited to 'src/winconsole.cpp')
| -rw-r--r-- | src/winconsole.cpp | 8 |
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; } |
