How to implement Unicode string matching by folding in python

后端 未结 5 963
灰色年华
灰色年华 2020-12-13 11:31

I have an application implementing incremental search. I have a catalog of unicode strings to be matched and match them to a given \"key\" string; a catalog string is a \"hi

5条回答
  •  清歌不尽
    2020-12-13 12:13

    What about this one:

    normalize('NFKD', unicode_string).encode('ASCII', 'ignore').lower()
    

    Taken from here (Spanish) http://python.org.ar/pyar/Recetario/NormalizarCaracteresUnicode

提交回复
热议问题