summaryrefslogtreecommitdiffstats
path: root/util/unicode
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2012-11-22 03:25:05 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-11-23 11:59:50 +0100
commit2fbb69a09361bf1ecf517516f76405c3be494d6d (patch)
tree9330626943971c1feb5570532963236f8a9935d6 /util/unicode
parent44b1c5dde2dfbb69a29cbd4ad8d1f0ac0203b482 (diff)
QTBF: Fix issue with no splitting the words at "." (FULL STOP)
As of Unicode 5.1, some punctuation marks were mapped to MidLetter and MidNumLet for better URL and abbreviations handling which caused "hi.there" to be treated like if it were just a single word; until we have the Unicode Text Segmentation tailoring mechanism, retain the old behavior by remapping (some of) those characters back to their old values. Change-Id: I49dea6064f2ea40a82fc0b1bc3c4f0b4e803919f Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'util/unicode')
-rw-r--r--util/unicode/main.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/util/unicode/main.cpp b/util/unicode/main.cpp
index 7bc667ca14..8e612f0b03 100644
--- a/util/unicode/main.cpp
+++ b/util/unicode/main.cpp
@@ -1572,6 +1572,15 @@ static void readWordBreak()
qFatal("unassigned word break class: %s", l[1].constData());
for (int codepoint = from; codepoint <= to; ++codepoint) {
+ // ### [
+ // as of Unicode 5.1, some punctuation marks were mapped to MidLetter and MidNumLet
+ // which caused "hi.there" to be treated like if it were just a single word;
+ // until we have a tailoring mechanism, retain the old behavior by remapping those characters here.
+ if (codepoint == 0x002E) // FULL STOP
+ brk = WordBreak_MidNum;
+ else if (codepoint == 0x003A) // COLON
+ brk = WordBreak_Other;
+ // ] ###
UnicodeData &ud = UnicodeData::valueRef(codepoint);
ud.p.wordBreakClass = brk;
}