From ed2b110b6add650954dc102a0317c14ff826c677 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 13 Jan 2020 15:46:13 +0100 Subject: Allow surrogate pairs for various "single character" locale data Extract the character in its proper unicode form and encode it in a new single_character_data table of locale data. Record each entry as the range within that table that encodes it. Also added an assertion in the generator script to check that the digits CLDR gives us are a contiguous sequence in increasing order, as has been assumed by the C++ code for some time. Lots of number-formatting code now has to take account of how wide the digits are. This leaves nowhere for updateSystemPrivate() to record values read from sys_locale->query(), so we must always consult that function when accessing these members of the systemData() object. Various internal users of these single-character fields need the system-or-CLDR value rather than the raw CLDR value, so move QLocalePrivate's methods to supply them down to QLocaleData and ensure they check for system values, where appropriate first. This allows us to finally support the Chakma language and script, for whose number system UTF-16 needs surrogate pairs. Costs 10.8 kB in added data, much of it due to adding two new locales that need surrogates to represent digits. [ChangeLog][QtCore][QLocale] Various QLocale methods that returned single QChar values now return QString values to accommodate those locales which need a surrogate pair to represent the (single character) return value. Fixes: QTBUG-69324 Fixes: QTBUG-81053 Change-Id: I481722d6f5ee266164f09031679a851dfa6e7839 Reviewed-by: Thiago Macieira --- src/corelib/text/qlocale.h | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'src/corelib/text/qlocale.h') diff --git a/src/corelib/text/qlocale.h b/src/corelib/text/qlocale.h index a9933bbb2e..a4262a3ab8 100644 --- a/src/corelib/text/qlocale.h +++ b/src/corelib/text/qlocale.h @@ -1049,15 +1049,13 @@ public: # endif // 5.15 #endif - // ### Qt 6: We need to return QString from these function since - // UTF-16 may need surrogate pairs to represent these fields. - QChar decimalPoint() const; - QChar groupSeparator() const; - QChar percent() const; - QChar zeroDigit() const; - QChar negativeSign() const; - QChar positiveSign() const; - QChar exponential() const; + QString decimalPoint() const; + QString groupSeparator() const; + QString percent() const; + QString zeroDigit() const; + QString negativeSign() const; + QString positiveSign() const; + QString exponential() const; QString monthName(int, FormatType format = LongFormat) const; QString standaloneMonthName(int, FormatType format = LongFormat) const; -- cgit v1.2.3