diff options
-rw-r--r-- | src/corelib/text/qchar.cpp | 4 | ||||
-rw-r--r-- | tests/auto/corelib/text/qchar/tst_qchar.cpp | 19 |
2 files changed, 21 insertions, 2 deletions
diff --git a/src/corelib/text/qchar.cpp b/src/corelib/text/qchar.cpp index dcc36d18ce..5a2ff34228 100644 --- a/src/corelib/text/qchar.cpp +++ b/src/corelib/text/qchar.cpp @@ -1885,7 +1885,7 @@ inline bool operator<(const UCS2SurrogatePair &ligature, uint u1) static uint inline ligatureHelper(uint u1, uint u2) { - if (u1 >= Hangul_LBase && u1 <= Hangul_SBase + Hangul_SCount) { + if (u1 >= Hangul_LBase && u1 < Hangul_SBase + Hangul_SCount) { // compute Hangul syllable composition as per UAX #15 // hangul L-V pair const uint LIndex = u1 - Hangul_LBase; @@ -1898,7 +1898,7 @@ static uint inline ligatureHelper(uint u1, uint u2) const uint SIndex = u1 - Hangul_SBase; if (SIndex < Hangul_SCount && (SIndex % Hangul_TCount) == 0) { const uint TIndex = u2 - Hangul_TBase; - if (TIndex <= Hangul_TCount) + if (TIndex < Hangul_TCount && TIndex) return u1 + TIndex; } } diff --git a/tests/auto/corelib/text/qchar/tst_qchar.cpp b/tests/auto/corelib/text/qchar/tst_qchar.cpp index 0773fd7b82..3c621948fe 100644 --- a/tests/auto/corelib/text/qchar/tst_qchar.cpp +++ b/tests/auto/corelib/text/qchar/tst_qchar.cpp @@ -997,6 +997,25 @@ void tst_QChar::normalization_manual() QVERIFY(decomposed.normalized(QString::NormalizationForm_KD) == decomposed); QVERIFY(decomposed.normalized(QString::NormalizationForm_KC) == composed); } + // QTBUG-71894 - erratum fixed in Unicode 4.1.0; SCount bounds are < not <= + { + // Hangul compose, test 0x11a7: + const QChar c[] = { QChar(0xae30), QChar(0x11a7), {} }; + const QChar d[] = { QChar(0x1100), QChar(0x1175), QChar(0x11a7), {} }; + const QString composed(c, 2); + const QString decomposed(d, 3); + + QCOMPARE(decomposed.normalized(QString::NormalizationForm_C), composed); + } + { + // Hangul compose, test 0x11c3: + const QChar c[] = { QChar(0xae30), QChar(0x11c3), {} }; + const QChar d[] = { QChar(0x1100), QChar(0x1175), QChar(0x11c3), {} }; + const QString composed(c, 2); + const QString decomposed(d, 3); + + QCOMPARE(decomposed.normalized(QString::NormalizationForm_C), composed); + } } void tst_QChar::normalizationCorrections() |