From 3edc3ffa025002dd08da74f064755fee2d128a29 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Fri, 2 Oct 2020 16:59:58 +0200 Subject: [PATCH] Normalize before removing wrong letters --- media/forms.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/media/forms.py b/media/forms.py index fe77bfd..e5b19a0 100644 --- a/media/forms.py +++ b/media/forms.py @@ -31,7 +31,6 @@ def generate_side_identifier(title, authors, subtitle=None): title_normalized = re.sub(r'^THE ', '', title_normalized) title_normalized = re.sub(r'Œ', 'OE', title_normalized) title_normalized = title_normalized.replace(' ', '') - title_normalized = re.sub("[^A-Z0-9$]", "", title_normalized) title_normalized = ''.join( char for char in unicodedata.normalize( @@ -39,6 +38,7 @@ def generate_side_identifier(title, authors, subtitle=None): if all(not unicodedata.category(char).startswith(cat) for cat in {'M', 'P', 'Z', 'C'}) or char == ' ' ).casefold().upper() + title_normalized = re.sub("[^A-Z0-9$]", "", title_normalized) authors = authors.copy() def sort(author):