mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
fix note importing detecting changes due to unicode differences
https://forums.ankiweb.net/t/python-checksum-rust-checksum/8195/16
This commit is contained in:
parent
f08c5a9905
commit
7273996041
3 changed files with 7 additions and 0 deletions
|
@ -6,6 +6,7 @@ import unicodedata
|
||||||
from typing import Dict, List, Optional, Tuple, Union
|
from typing import Dict, List, Optional, Tuple, Union
|
||||||
|
|
||||||
from anki.collection import Collection
|
from anki.collection import Collection
|
||||||
|
from anki.config import Config
|
||||||
from anki.consts import NEW_CARDS_RANDOM, STARTING_FACTOR
|
from anki.consts import NEW_CARDS_RANDOM, STARTING_FACTOR
|
||||||
from anki.importing.base import Importer
|
from anki.importing.base import Importer
|
||||||
from anki.lang import TR
|
from anki.lang import TR
|
||||||
|
@ -315,6 +316,10 @@ where id = ? and flds != ?""",
|
||||||
sidx = self._fmap[f][0]
|
sidx = self._fmap[f][0]
|
||||||
fields[sidx] = note.fields[c]
|
fields[sidx] = note.fields[c]
|
||||||
note.fieldsStr = joinFields(fields)
|
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:
|
def updateCards(self) -> None:
|
||||||
data = []
|
data = []
|
||||||
|
|
|
@ -1330,6 +1330,7 @@ message Config {
|
||||||
INTERRUPT_AUDIO_WHEN_ANSWERING = 12;
|
INTERRUPT_AUDIO_WHEN_ANSWERING = 12;
|
||||||
PASTE_IMAGES_AS_PNG = 13;
|
PASTE_IMAGES_AS_PNG = 13;
|
||||||
PASTE_STRIPS_FORMATTING = 14;
|
PASTE_STRIPS_FORMATTING = 14;
|
||||||
|
NORMALIZE_NOTE_TEXT = 15;
|
||||||
}
|
}
|
||||||
Key key = 1;
|
Key key = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ impl From<BoolKeyProto> for BoolKey {
|
||||||
BoolKeyProto::InterruptAudioWhenAnswering => BoolKey::InterruptAudioWhenAnswering,
|
BoolKeyProto::InterruptAudioWhenAnswering => BoolKey::InterruptAudioWhenAnswering,
|
||||||
BoolKeyProto::PasteImagesAsPng => BoolKey::PasteImagesAsPng,
|
BoolKeyProto::PasteImagesAsPng => BoolKey::PasteImagesAsPng,
|
||||||
BoolKeyProto::PasteStripsFormatting => BoolKey::PasteStripsFormatting,
|
BoolKeyProto::PasteStripsFormatting => BoolKey::PasteStripsFormatting,
|
||||||
|
BoolKeyProto::NormalizeNoteText => BoolKey::NormalizeNoteText,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue