[imp] db migration and sorting

Michael M Slusarz slusarz at horde.org
Tue May 24 15:59:32 UTC 2011


Quoting Jan Schneider <jan at horde.org>:

> Zitat von Michael M Slusarz <slusarz at horde.org>:
>
>> Quoting Janis Eisaks <je at ktf.rtu.lv>:
>>
>>> Quoting Jan Schneider <jan at horde.org>:
>>>
>>>>> 2. what can be done to display folder list in alphabetical order  
>>>>> for selected language - for example letter "č" in Latvian  
>>>>> follows "c", not "z"
>>>>>
>>>>> Horde 1.0.8 places national letters before A, 1.2.9 and  
>>>>> Horde4/IMP5 - after Z
>>>>
>>>> We use strnatcasecmp and strcasecmp for sorting mailboxes. Those  
>>>> have the advantage of correctly sorting mailboxes with numbers  
>>>> and being binary-safe. For better locale-specific sorting, we  
>>>> would have to use strcoll, but this function doesn't support  
>>>> either of the former features.
>>>
>>> so - resumé - it is not possible to get folders in correct  
>>> alphabetical order rathen than for ASCII-named, isn't it?
>>
>> It looks like we might be able to use Collator::compare()  
>> (http://www.php.net/manual/en/collator.compare.php) to do the  
>> sorting.  But this is only available in PHP 5.3.0+.
>
> We could use it conditionally, it's also available through intl from  
> pecl for PHP 5.2. But I'm not sure if that would get us anything  
> that strcoll doesn't. The documentation is sparse, but to me it  
> sounds like it doesn't get us natural numeric sort or binary safety  
> (probably not necessary for mailbox sorting anyway) either.

Well... I'm not sure that our current sorting method is all that bad.   
It's at least consistent.  And if PHP does not provide the proper  
tools to easily do this kind of sorting, I would rather not reinvent  
the wheel.

michael

___________________________________
Michael Slusarz [slusarz at horde.org]



More information about the imp mailing list