From 70802f4574e354f8d70900f4db6dd968b9f952ef Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Wed, 27 Jan 2021 23:24:07 +0000 Subject: [PATCH] Set C++ global locale as well as C one, so wide to narrow works --- main.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/main.cpp b/main.cpp index 85e5cc95f..0960789e0 100644 --- a/main.cpp +++ b/main.cpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #include @@ -129,10 +129,13 @@ int main(int argc, char *argv[]) // LOG_INFO ("--------------------------- Resources ----------------------------"); QLocale locale; // get the current system locale - setlocale (LC_NUMERIC, "C"); // ensure number forms are in - // consistent format, do this after - // instantiating QApplication so - // that GUI has correct l18n + + // Set C/C++ locale used for logging etc. +#if defined (Q_OS_WIN) + std::locale::global (std::locale ("C")); +#else + std::locale::global (std::locale ("en_US.UTF-8")); +#endif // Override programs executable basename as application name. a.setApplicationName ("WSJT-X");