1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

windows: Unicode input in REPL

This commit is contained in:
vitalyster
2019-09-20 17:03:13 +03:00
committed by Alexander Medvednikov
parent f042dfb861
commit f1bb25bfaf
5 changed files with 21 additions and 11 deletions

View File

@ -355,6 +355,10 @@ fn (v mut V) generate_main() {
// vlib can't have `init_consts()`
cgen.genln('void init_consts() {
#ifdef _WIN32
DWORD consoleMode;
BOOL isConsole = GetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), &consoleMode);
int mode = isConsole ? _O_U16TEXT : _O_U8TEXT;
_setmode(_fileno(stdin), mode);
_setmode(_fileno(stdout), _O_U8TEXT);
SetConsoleMode(GetStdHandle(STD_OUTPUT_HANDLE), ENABLE_PROCESSED_OUTPUT | 0x0004);
// ENABLE_VIRTUAL_TERMINAL_PROCESSING

View File

@ -292,8 +292,7 @@ pub fn (v mut V) cc_msvc() {
'oleaut32.lib',
'uuid.lib',
'odbc32.lib',
'odbccp32.lib',
'vcruntime.lib',
'odbccp32.lib'
]
mut inc_paths := []string{}

View File

@ -1,3 +1,7 @@
println('hello world')
println('Hello, world!')
println('Привет, мир!')
println('你好世界')
===output===
hello world
Hello, world!
Привет, мир!
你好世界