Ticket #13541 (confirmed Bug)

Opened 3 years ago

Last modified 3 years ago

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?

Change History

comment:1 Changed 3 years ago by kleist

  • Keywords sorting, localization, catalogsortable_title added; sortinglocalizationcatalogsortable_title removed
  • Status changed from new to confirmed
  • Component changed from Unknown to Backend (Python)

comment:2 Changed 3 years ago by kleist

  • Keywords catalog, sortable_title added; catalogsortable_title removed
Note: See TracTickets for help on using tickets.