Opened 12 years ago

Last modified 11 years ago

#3588 closed defect

Search in home view should be done in normalized strings — at Version 1

Reported by: manuq Owned by:
Priority: Unspecified by Maintainer Milestone:
Component: Sugar Version: 0.97.x
Severity: Unspecified Keywords: olpc-test-passed
Cc: garycmartin Distribution/OS: Unspecified
Bug Status: Unconfirmed

Description (last modified by manuq)

TestCase:

  • switch your Sugar to Spanish
  • install Abacus, which is named Ábaco in Spanish
  • search for "aba" in the home view
  • Ábaco should be in the selected activities

This is pretty standard search functionality. Currently, you have to type matching even the character cases. Would be nice to ignore case sensitiveness, and normalize to ASCII equivalents, like 'á' -> 'a'. This can be easily done with the following function:

from unicodedata import normalize

def normalize_string(unicode_string):
    u"""Return unicode_string normalized for searching.

    >>> normalize_string(u'Mónica Viñao')
    'monica vinao'
    
    """
    return normalize('NFKD', unicode_string).encode('ASCII', 'ignore').lower()

(stolen from http://python.org.ar/pyar/Recetario/NormalizarCaracteresUnicode)

Change History (1)

comment:1 Changed 12 years ago by manuq

  • Description modified (diff)
Note: See TracTickets for help on using tickets.