diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp index 5398820916a..542cf9785c9 100644 --- a/src/corelib/text/qlocale.cpp +++ b/src/corelib/text/qlocale.cpp @@ -4540,7 +4540,7 @@ bool QLocaleData::numberToCLocale(QStringView s, QLocale::NumberOptions number_o return false; stage = Fraction; } else if (out == 'e') { - if (stage == Name) + if (wantDigits || stage == Name || stage > Fraction) return false; if (stage < Fraction) { diff --git a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp index 448ae037511..f7f058bba8e 100644 --- a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp @@ -909,6 +909,9 @@ void tst_QLocale::toReal_data() QTest::newRow("C 1.") << QString("C") << QString("1.") << true << 1.0; QTest::newRow("C 1.E10") << QString("C") << QString("1.E10") << true << 1.0e10; QTest::newRow("C 1e+10") << QString("C") << QString("1e+10") << true << 1.0e+10; + QTest::newRow("C e+10") << QString("C") << QString("e+10") << false << 0.0; + QTest::newRow("C .e+10") << QString("C") << QString(".e+10") << false << 0.0; + QTest::newRow("C 1e+2e+10") << QString("C") << QString("1e+2e+10") << false << 0.0; QTest::newRow("de_DE 1.") << QString("de_DE") << QString("1.") << false << 0.0; QTest::newRow("de_DE 1.2") << QString("de_DE") << QString("1.2") << false << 0.0;