diff --git a/pylib/anki/collection.py b/pylib/anki/collection.py index 2df64a6f9..296a1e74a 100644 --- a/pylib/anki/collection.py +++ b/pylib/anki/collection.py @@ -1010,7 +1010,9 @@ and type=0""", to_fix = [] for id, tags in self.db.execute("select id, tags from notes"): norm = unicodedata.normalize("NFC", tags) - if not norm.startswith(" ") or not norm.endswith(" "): + if not norm.strip(): + norm = "" + elif not norm.startswith(" ") or not norm.endswith(" "): norm = " " + norm + " " if norm != tags: to_fix.append((norm, self.usn(), intTime(), id))