diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp index 5ff1825100e..964451491cc 100644 --- a/src/corelib/text/qlocale.cpp +++ b/src/corelib/text/qlocale.cpp @@ -4659,7 +4659,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 2cb47e52236..921498c4a3c 100644 --- a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp @@ -913,6 +913,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;