diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-12-21 08:38:14 +0200 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-12-21 09:07:59 +0200 |
commit | 3d8a942a56e1de32e23cd02eada3899c4d6d1033 (patch) | |
tree | ad5ae371215a78efccf133562333005ec5f99494 /platform/windows | |
parent | 2a04b18d37de6c6e621db5a9dfd1cd0da5ccb015 (diff) |
Fix reading Unicode from stdio.
Diffstat (limited to 'platform/windows')
-rw-r--r-- | platform/windows/os_windows.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index a083a98c72..f8633d29ac 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -1164,8 +1164,11 @@ bool OS_Windows::set_environment(const String &p_var, const String &p_value) con String OS_Windows::get_stdin_string(bool p_block) { if (p_block) { - char buff[1024]; - return fgets(buff, 1024, stdin); + WCHAR buff[1024]; + DWORD count = 0; + if (ReadConsoleW(GetStdHandle(STD_INPUT_HANDLE), buff, 1024, &count, nullptr)) { + return String::utf16((const char16_t *)buff, count); + } } return String(); |