Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(446)

Unified Diff: runtime/bin/platform_win.cc

Issue 2894353002: [windows] Don't set/restore the code page if it's already been set (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/platform_win.cc
diff --git a/runtime/bin/platform_win.cc b/runtime/bin/platform_win.cc
index 75711325e107ffcd5a4e50ddf6e270cc71da0f19..af3845595c1e902fdbaeffd79fb2ec72c397b2bd 100644
--- a/runtime/bin/platform_win.cc
+++ b/runtime/bin/platform_win.cc
@@ -78,10 +78,16 @@ class PlatformWin {
// Set both the input and output code pages to UTF8.
ASSERT(saved_output_cp_ == -1);
ASSERT(saved_input_cp_ == -1);
- saved_output_cp_ = GetConsoleOutputCP();
- saved_input_cp_ = GetConsoleCP();
- SetConsoleOutputCP(CP_UTF8);
- SetConsoleCP(CP_UTF8);
+ const int output_cp = GetConsoleOutputCP();
+ const int input_cp = GetConsoleCP();
+ if (output_cp != CP_UTF8) {
+ SetConsoleOutputCP(CP_UTF8);
+ saved_output_cp_ = output_cp;
+ }
+ if (input_cp != CP_UTF8) {
+ SetConsoleCP(CP_UTF8);
+ saved_input_cp_ = input_cp;
+ }
// Try to set the bits for ANSI support, but swallow any failures.
HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698