Peter Otten <__pete...@web.de>:

> The standard recommendation is to convert bytes to unicode as early as
> possible and only manipulate unicode.

Unicode doesn't get you off the hook (as you explain later in your
post). Upper/lowercase as well as collation order is ambiguous. Python
even with decent locale support can't be expected to do it all for you.

Well, if Python can't, then who can? Probably nobody in the world, not
generically, anyway.

Example:

    >>> print("re\u0301sume\u0301")
    résumé
    >>> print("r\u00e9sum\u00e9")
    résumé
    >>> print("re\u0301sume\u0301" == "r\u00e9sum\u00e9")
    False
    >>> print("\ufb01nd")
    find
    >>> print("find")
    find
    >>> print("\ufb01nd" == "find")
    False

If equality can't be determined, words really can't be sorted.


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to