From 550242226eaa68462c0180f8730e880cf9362cc0 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Mon, 24 Aug 2020 11:54:00 +0200 Subject: [PATCH] :art: Normalize - to _ since these characters are used a lot --- apps/note/models/notes.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/note/models/notes.py b/apps/note/models/notes.py index fe7f1750..90d2e9af 100644 --- a/apps/note/models/notes.py +++ b/apps/note/models/notes.py @@ -247,7 +247,8 @@ class Alias(models.Model): Normalizes a string: removes most diacritics, does casefolding and ignore non-ASCII characters """ return ''.join( - char for char in unicodedata.normalize('NFKD', string.casefold().replace('æ', 'ae').replace('œ', 'oe')) + char for char in unicodedata.normalize('NFKD', string.casefold().replace('æ', 'ae') + .replace('œ', 'oe').replace('-', '_')) if all(not unicodedata.category(char).startswith(cat) for cat in {'M', 'P', 'Z', 'C'})).casefold().encode('ascii', 'ignore').decode('ascii')