17 lines
409 B
Python
17 lines
409 B
Python
import unicodedata
|
|
|
|
|
|
def normalize_search_text(value: str | None) -> str:
|
|
if not value:
|
|
return ""
|
|
|
|
value = (
|
|
value.casefold()
|
|
.replace("ä", "ae")
|
|
.replace("ö", "oe")
|
|
.replace("ü", "ue")
|
|
.replace("ß", "ss")
|
|
)
|
|
normalized = unicodedata.normalize("NFKD", value)
|
|
return "".join(char for char in normalized if not unicodedata.combining(char))
|