diff --git a/pylib/anki/importing/noteimp.py b/pylib/anki/importing/noteimp.py index d73c62713..e3865f8c8 100644 --- a/pylib/anki/importing/noteimp.py +++ b/pylib/anki/importing/noteimp.py @@ -6,6 +6,7 @@ import unicodedata from typing import Dict, List, Optional, Tuple, Union from anki.collection import Collection +from anki.config import Config from anki.consts import NEW_CARDS_RANDOM, STARTING_FACTOR from anki.importing.base import Importer from anki.lang import TR @@ -315,6 +316,10 @@ where id = ? and flds != ?""", sidx = self._fmap[f][0] fields[sidx] = note.fields[c] note.fieldsStr = joinFields(fields) + # temporary fix for the following issue until we can update the code: + # https://forums.ankiweb.net/t/python-checksum-rust-checksum/8195/16 + if self.col.get_config_bool(Config.Bool.NORMALIZE_NOTE_TEXT): + note.fieldsStr = unicodedata.normalize("NFC", note.fieldsStr) def updateCards(self) -> None: data = [] diff --git a/rslib/backend.proto b/rslib/backend.proto index 443a59972..52240ea8b 100644 --- a/rslib/backend.proto +++ b/rslib/backend.proto @@ -1330,6 +1330,7 @@ message Config { INTERRUPT_AUDIO_WHEN_ANSWERING = 12; PASTE_IMAGES_AS_PNG = 13; PASTE_STRIPS_FORMATTING = 14; + NORMALIZE_NOTE_TEXT = 15; } Key key = 1; } diff --git a/rslib/src/backend/config.rs b/rslib/src/backend/config.rs index 9e8d59610..a141eb0e0 100644 --- a/rslib/src/backend/config.rs +++ b/rslib/src/backend/config.rs @@ -30,6 +30,7 @@ impl From for BoolKey { BoolKeyProto::InterruptAudioWhenAnswering => BoolKey::InterruptAudioWhenAnswering, BoolKeyProto::PasteImagesAsPng => BoolKey::PasteImagesAsPng, BoolKeyProto::PasteStripsFormatting => BoolKey::PasteStripsFormatting, + BoolKeyProto::NormalizeNoteText => BoolKey::NormalizeNoteText, } } }