diff options
author | Mikhail Redko <ovitnez@gmail.com> | 2021-04-11 20:41:44 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-11 19:41:44 +0200 |
commit | 1539bed3db86f2153f2d0d5fbf24bf9ee4af1d92 (patch) | |
tree | ed25236f21145d23d6e3a3fc9d7ff62675a13ba9 /src/server/worldserver | |
parent | 6bdfa91fa795b24bfba6a4497784b693f6216638 (diff) |
Core/Misc: Fixed utf8 encoding in console input/output. (#26352)
* Core/Misc: Fixed utf8 encoding in console input/output.
* Fix gcc build
* Fixed that weird 'a' with circle above it and other similar letters. Also fixed encoding in AppenderConsole which sometimes did not work as it should
* Fix build on Linux
* Probably better to do it like this
Diffstat (limited to 'src/server/worldserver')
-rw-r--r-- | src/server/worldserver/CommandLine/CliRunnable.cpp | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/server/worldserver/CommandLine/CliRunnable.cpp b/src/server/worldserver/CommandLine/CliRunnable.cpp index 7b2624159ef..2d858c415d4 100644 --- a/src/server/worldserver/CommandLine/CliRunnable.cpp +++ b/src/server/worldserver/CommandLine/CliRunnable.cpp @@ -78,11 +78,7 @@ namespace Trinity::Impl::Readline void utf8print(void* /*arg*/, std::string_view str) { #if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS - std::wstring wbuf; - if (!Utf8toWStr(str, wbuf)) - return; - - wprintf(L"%s", wbuf.c_str()); + WriteWinConsole(str); #else { printf(STRING_VIEW_FMT, STRING_VIEW_FMT_ARG(str)); @@ -139,14 +135,10 @@ void CliThread() std::string command; #if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS - wchar_t commandbuf[256]; - if (fgetws(commandbuf, sizeof(commandbuf), stdin)) + if (!ReadWinConsole(command)) { - if (!WStrToUtf8(commandbuf, wcslen(commandbuf), command)) - { - PrintCliPrefix(); - continue; - } + PrintCliPrefix(); + continue; } #else char* command_str = readline(CLI_PREFIX); |