[Development] Using QCollator on different platforms, without ICU

Sorvig Morten Morten.Sorvig at digia.com
Thu Aug 15 16:02:04 CEST 2013


On Aug 15, 2013, at 2:49 PM, Knoll Lars <Lars.Knoll at digia.com> wrote:

> On 15.08.13 14:39, "Sorvig Morten" <Morten.Sorvig at digia.com> wrote:
> 
>> 
>> On Aug 15, 2013, at 1:13 PM, Knoll Lars <Lars.Knoll at digia.com> wrote:
>>>> 
>>>> sortKey: the lack of OS X support is worrying... didn't they have just
>>>> a
>>>> simple wrapper around ICU?
>>> 
>>> Yes, that's weird. I'd propose to load the required symbol dynamically
>>> from ICU on Mac.
>> 
>> This is not app-store safe - I will not sleep well at night if we go for
>> that solution :)
>> 
>> To me the main use case of QCollator is "compare these two strings
>> according to the user locale". The app can't really know or control how
>> the strings will be sorted, and on OS X there is actually an "Order for
>> sorted list" setting which determines how. This setting includes options
>> like Tradidional/Reformed/Phonetic for some languages.
>> 
>> For more advanced use cases we should have the option of bundling
>> ICU+data with the app.
> 
> The sort key is actually something that returns a key for a string that
> can then by sorted by simple strcmp. This is relatively important if you
> want to sort large lists in a fast way. So I wonder how this is being done
> on OSX, as I do believe they've hit that use case as well.
> 

UCCreateCollator / UCGetCollationKey / UCCompareCollationKeys from UnicodeUtilities.h might be the right API for that use case. It's available on all OS X versions but not on iOS.

Morten




More information about the Development mailing list