Mercurial > hg > orthanc
changeset 6288:0fb251145172
Under Windows: configure the console to UTF-8
author | Alain Mazy <am@orthanc.team> |
---|---|
date | Thu, 28 Aug 2025 15:19:41 +0200 |
parents | 2f96938428c7 |
children | 22ddac5de96e |
files | NEWS OrthancServer/Sources/main.cpp |
diffstat | 2 files changed, 14 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/NEWS Thu Aug 28 11:07:25 2025 +0200 +++ b/NEWS Thu Aug 28 15:19:41 2025 +0200 @@ -1,6 +1,12 @@ Pending changes in the mainline =============================== +Maintenance +----------- + +* Under Windows, the console output is now configured to interpret strings as UTF-8. + This notably allow cyrillic strings to display correctly in the console. + Version 1.12.9 (2025-08-11) ===========================
--- a/OrthancServer/Sources/main.cpp Thu Aug 28 11:07:25 2025 +0200 +++ b/OrthancServer/Sources/main.cpp Thu Aug 28 15:19:41 2025 +0200 @@ -52,6 +52,9 @@ #include <boost/algorithm/string/predicate.hpp> +#if defined(_WIN32) || defined(__CYGWIN__) +#include <windows.h> +#endif using namespace Orthanc; @@ -1866,6 +1869,11 @@ int main(int argc, char* argv[]) { +#if defined(_WIN32) || defined(__CYGWIN__) + // Set Windows console output to UTF-8 (otherwise, strings are considered to be in UTF-16. For example, Cyrillic UTF-8 strings appear as garbage without that config) + SetConsoleOutputCP(CP_UTF8); +#endif + Logging::Initialize(); Logging::SetCurrentThreadName("MAIN"); SetGlobalVerbosity(Verbosity_Default);