Skip to content

Commit 67b2b30

Browse files
committed
cleanup
1 parent d408ba1 commit 67b2b30

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

src/Plugins/Qt/qt_gui.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,22 @@ gui_open (int& argc, char** argv) {
495495
#ifdef MACOSX_EXTENSIONS
496496
mac_begin_remote();
497497
#endif
498+
499+
// Qt and Guile want to change the locale.
500+
// We reset it to have POSIX functions parse correctly the configuration files
501+
// (see as_double() in string.cpp)
502+
503+
setlocale(LC_NUMERIC, "C");
504+
505+
// From Qt docs:
506+
// On Unix/Linux Qt is configured to use the system locale settings by
507+
// default. This can cause a conflict when using POSIX functions, for
508+
// instance, when converting between data types such as floats and strings,
509+
// since the notation may differ between locales. To get around this problem,
510+
// call the POSIX function setlocale(LC_NUMERIC,"C") right after initializing
511+
// QApplication, QGuiApplication or QCoreApplication to reset the locale
512+
// that is used for number formatting to "C"-locale.
513+
// See https://doc.qt.io/qt-5/qcoreapplication.html#locale-settings
498514
}
499515

500516
void

src/Texmacs/Texmacs/texmacs.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -430,20 +430,14 @@ TeXmacs_main (int argc, char** argv) {
430430
if (DEBUG_STD) debug_boot << "Opening display...\n";
431431

432432
#if defined(X11TEXMACS) && defined(MACOSX_EXTENSIONS)
433-
init_mac_application ();
433+
// init_mac_application ();
434434
#endif
435435

436436
gui_open (argc, argv);
437437
set_default_font (the_default_font);
438438
if (DEBUG_STD) debug_boot << "Starting server...\n";
439439
{ // opening scope for server sv
440440
server sv;
441-
442-
// HACK:
443-
// Qt and Guile want to change the locale.
444-
// We need to force it to C to parse correctly the configuration files
445-
// (see as_double() in string.cpp)
446-
setlocale(LC_NUMERIC, "C");
447441

448442
string where= "";
449443
for (i=1; i<argc; i++) {

0 commit comments

Comments
 (0)