diff options
| author | Mikhail Redko <ovitnez@gmail.com> | 2021-04-11 20:41:44 +0300 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2022-03-08 15:57:30 +0100 |
| commit | f7441f02349500b46341f76b054f5ef1eb7baa1d (patch) | |
| tree | 91cfeafc858fa174203908768797c369c2c258ce /src/server/worldserver/CommandLine | |
| parent | 0d51e52aa608c85517035fb378500be01b0e578e (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
(cherry picked from commit 1539bed3db86f2153f2d0d5fbf24bf9ee4af1d92)
Diffstat (limited to 'src/server/worldserver/CommandLine')
| -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 a46d39478fe..2aeaeab8cb6 100644 --- a/src/server/worldserver/CommandLine/CliRunnable.cpp +++ b/src/server/worldserver/CommandLine/CliRunnable.cpp @@ -72,11 +72,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)); @@ -133,14 +129,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); |
