Skip to content

Commit 9c5469b

Browse files
authored
Merge pull request #5783 from ab9rf/win-utf8-console
use utf8 in windows console
2 parents 1ba2130 + 95e89e9 commit 9c5469b

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

docs/changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Template for new versions:
3333
## New Features
3434

3535
## Fixes
36+
- Core: Windows console will always use UTF-8 regardless of system code page settings
3637

3738
## Misc Improvements
3839

library/Console-windows.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,10 @@ bool Console::init(bool)
474474
HMENU hm = GetSystemMenu(d->ConsoleWindow,false);
475475
DeleteMenu(hm, SC_CLOSE, MF_BYCOMMAND);
476476

477+
// force console code pages to utf-8
478+
SetConsoleCP(CP_UTF8);
479+
SetConsoleOutputCP(CP_UTF8);
480+
477481
// set the screen buffer to be big enough to let us scroll text
478482
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &coninfo);
479483
d->default_attributes = coninfo.wAttributes;

0 commit comments

Comments
 (0)