Fix case-sensitivity of exponent separator check in Cyrillic fall-back
When matching the locale's correct exponent separator, QLocale was doing a case-insensitive match; but the Cyrillic fall-back was matching case-sensitively, so failed to catch the case of lower-case e and its Cyrillic equivalent, when used in a Cyrillic font in place of the upper-case form of the other, where that's the locale's official separator. So make this comparison case-insensitive. Added some test-cases for the lower-case exponential separator. Pick-to: 6.5 Fixes: QTBUG-113443 Change-Id: I18e22d7b3451fbb61e87d5b93661eadff3c7356e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>bb10
parent
637e1542cf
commit
4768fcf836
|
|
@ -4065,7 +4065,8 @@ char NumericTokenizer::nextToken()
|
|||
// writing Cyrillic may well use that; and Ukrainians might well use E.
|
||||
// All other Cyrillic locales (officially) use plain ASCII E.
|
||||
if (m_guide.exponentCyrillic // Only true in scientific float mode.
|
||||
&& (tail.startsWith(u"\u0415") || tail.startsWith(u"E"))) {
|
||||
&& (tail.startsWith(u"\u0415", Qt::CaseInsensitive)
|
||||
|| tail.startsWith(u"E", Qt::CaseInsensitive))) {
|
||||
++m_index;
|
||||
return 'e';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -916,8 +916,12 @@ void tst_QLocale::toReal_data()
|
|||
// may be some cross-over between these.
|
||||
QTest::newRow("uk_UA Cyrillic E") << u"uk_UA"_s << u"4\u0415-3"_s << true << 4e-3; // Official
|
||||
QTest::newRow("uk_UA Latin E") << u"uk_UA"_s << u"4E-3"_s << true << 4e-3;
|
||||
QTest::newRow("uk_UA Cyrilic e") << u"uk_UA"_s << u"4\u0435-3"_s << true << 4e-3;
|
||||
QTest::newRow("uk_UA Latin e") << u"uk_UA"_s << u"4e-3"_s << true << 4e-3;
|
||||
QTest::newRow("ru_RU Latin E") << u"ru_RU"_s << u"4E-3"_s << true << 4e-3; // Official
|
||||
QTest::newRow("ru_RU Cyrillic E") << u"ru_RU"_s << u"4\u0415-3"_s << true << 4e-3;
|
||||
QTest::newRow("ru_RU Latin e") << u"ru_RU"_s << u"4e-3"_s << true << 4e-3;
|
||||
QTest::newRow("ru_RU Cyrilic e") << u"ru_RU"_s << u"4\u0435-3"_s << true << 4e-3;
|
||||
}
|
||||
|
||||
void tst_QLocale::stringToDouble_data()
|
||||
|
|
|
|||
Loading…
Reference in New Issue