Skip to content

Instantly share code, notes, and snippets.

@Shauren
Last active January 12, 2019 10:03
Show Gist options
  • Save Shauren/271d6aa93dec96d8e9be2febb9a54661 to your computer and use it in GitHub Desktop.
Save Shauren/271d6aa93dec96d8e9be2febb9a54661 to your computer and use it in GitHub Desktop.
diff --git a/dep/boost/CMakeLists.txt b/dep/boost/CMakeLists.txt
index 57e9d0c4f6..4a2332c2c1 100644
--- a/dep/boost/CMakeLists.txt
+++ b/dep/boost/CMakeLists.txt
@@ -77,7 +77,8 @@ target_compile_definitions(boost
-DBOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE
-DBOOST_CHRONO_NO_LIB
-DBOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE
- -DBOOST_ASIO_NO_DEPRECATED)
+ -DBOOST_ASIO_NO_DEPRECATED
+ -DBOOST_SYSTEM_USE_UTF8)
if (NOT boost_filesystem_copy_links_without_NO_SCOPED_ENUM)
target_compile_definitions(boost
diff --git a/src/server/worldserver/CommandLine/CliRunnable.cpp b/src/server/worldserver/CommandLine/CliRunnable.cpp
index ec7400e00f..b5cc86eaa4 100644
--- a/src/server/worldserver/CommandLine/CliRunnable.cpp
+++ b/src/server/worldserver/CommandLine/CliRunnable.cpp
@@ -147,8 +147,12 @@ void CliThread()
char *command_str ; // = fgets(commandbuf, sizeof(commandbuf), stdin);
#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
- char commandbuf[256];
- command_str = fgets(commandbuf, sizeof(commandbuf), stdin);
+ wchar_t commandbuf[256];
+ std::string commandbuf_a;
+ if (fgetws(commandbuf, sizeof(commandbuf), stdin) && WStrToUtf8(commandbuf, wcslen(commandbuf), commandbuf_a))
+ command_str = const_cast<char*>(commandbuf_a.data());
+ else
+ command_str = nullptr;
#else
command_str = readline("TC>");
rl_bind_key('\t', rl_complete);
@@ -173,16 +177,7 @@ void CliThread()
continue;
}
- std::string command;
- if (!consoleToUtf8(command_str, command)) // convert from console encoding to utf8
- {
-#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
- printf("TC>");
-#else
- free(command_str);
-#endif
- continue;
- }
+ std::string command = command_str;
fflush(stdout);
sWorld->QueueCliCommand(new CliCommandHolder(nullptr, command.c_str(), &utf8print, &commandFinished));
@jackpoz
Copy link

jackpoz commented Jan 12, 2019

World initialized in 0 minutes 57 seconds
TC>TrinityCore rev. 95398fadf958+ 2019-01-11 17:52:21 +0100 (3.3.5 branch) (Win64, Debug, Static) (worldserver-daemon) ready...
account set gmlevel å 0 -1
Account å does not exist.
TC>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment