From 421c69fde579baf21cb0fd607a7cfd97e6e63220 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 16 Mar 2021 16:02:56 +0100 Subject: [PATCH] Add .UTF-8 suffixes to locale-names passed to setlocale() We use UTF-8 locales by default since Qt 6; and relatively few systems have the encoding-unspecified locales we were trying to use, with the result that the setlocale() calls all failed. Task-number: COIN-689 Change-Id: Id791ba269bf4abac29da3daa4fd01684ca9caa7a Reviewed-by: Thiago Macieira Reviewed-by: Qt CI Bot --- tests/auto/corelib/text/qlocale/tst_qlocale.cpp | 6 +++--- tests/auto/corelib/text/qstring/tst_qstring.cpp | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp index 32b47dbe01..986bc1e25e 100644 --- a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp @@ -922,7 +922,7 @@ void tst_QLocale::stringToDouble() { // Make sure result is independent of locale: - TransientLocale ignoreme(LC_ALL, "ar_SA"); + TransientLocale ignoreme(LC_ALL, "ar_SA.UTF-8"); QCOMPARE(locale.toDouble(num_str, &ok), d); QCOMPARE(ok, good); } @@ -1009,7 +1009,7 @@ void tst_QLocale::stringToFloat() { // Make sure result is independent of locale: - TransientLocale ignoreme(LC_ALL, "ar_SA"); + TransientLocale ignoreme(LC_ALL, "ar_SA.UTF-8"); QCOMPARE(locale.toFloat(num_str, &ok), f); QCOMPARE(ok, good); } @@ -1180,7 +1180,7 @@ void tst_QLocale::doubleToString() const QLocale locale(localeName); QCOMPARE(locale.toString(num, mode, precision), numStr); - TransientLocale ignoreme(LC_ALL, "de_DE"); + TransientLocale ignoreme(LC_ALL, "de_DE.UTF-8"); QCOMPARE(locale.toString(num, mode, precision), numStr); } diff --git a/tests/auto/corelib/text/qstring/tst_qstring.cpp b/tests/auto/corelib/text/qstring/tst_qstring.cpp index 5b5367abcd..8329948ef1 100644 --- a/tests/auto/corelib/text/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/text/qstring/tst_qstring.cpp @@ -5630,6 +5630,7 @@ void tst_QString::localeAwareCompare() QFETCH(QString, s1); QFETCH(QString, s2); QFETCH(int, result); + locale += QStringLiteral(".UTF-8"); // So we don't have to repeat it on every data row ! if (!locale.isEmpty()) { #if defined (Q_OS_DARWIN) || QT_CONFIG(icu)