Ticket #13541 (confirmed Bug)
current implementation of sortable_title appears to be broken for most locales.
Reported by: | tmog | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 4.x |
Component: | Backend (Python) | Version: | 4.3 |
Keywords: | sorting, localization, catalog, sortable_title | Cc: |
Description
Current titles are passed through plone.i18n.normalizer.base.mapUnicode. Presumably on the assumption that accented characters sort like their un-accented brethren. This is not correct for most languages.
This seems easy enough to fix by simply getting rid of the call to mapUnicode.
However sorting is still not quite perfect. We need to somehow take the locale into consideration when sorting titles.
The only way I've been able to reliably sort strings is using locale.strcoll to compare strings in the Catalog, but we cannot assume the underlying python/OS has the correct locale, can we? Could saving sortable_title as a locale.strxfrm value be a solution?
http://bytes.com/topic/python/answers/22954-trouble-sorting-lists-unicode-locale-related describes the exact sorting problem and general solution, but how do we implement this in the context of the catalog, and in a multilingual site?