kerrickstaley / genanki

A Python 3 library for generating Anki decks
MIT License
2.06k stars 161 forks source link

BUG? Incorrect parsing of < > in generation of fields for card #77

Closed felipejinli closed 3 years ago

felipejinli commented 3 years ago

My version Version ⁨2.1.36 (c505894b)⁩ Python 3.8.6 Qt 5.14.2 PyQt 5.14.2

Problem I am creating notes with genanki but I realised that for some notes which have the characters < /> in them they are partially parsed. So, I've checked the collections.anki2 file within the genanki-generate .apkg. (the following refers to the notes table of the Anki sqlite database) .E.g. for the flds value

2-Programming-Techniq...0code out the simplest c++ template for CP?#include <bits/stdc++.h>

using namsepace std;

int main() {
}

where each field is correctly separated by the 0x1f character, I incorrectly get the output shown on the image. The field is correctly set for other string values, so I was wondering if this is a bug relating to how it escapes < and > character? @kerrickstaley

I've disabled all add-ons to make sure it wasn't an add-on that incorrectly modified the card.

Screenshot 2021-04-21 at 19 05 48

[decks_info.json] [ { "name": "Guide to Competitive Programming", "cards": [ { "name": "code out the simplest c++ template for CP?", "back": "", "tags": [ "Guide-to-Competitive-Programming::2-Programming-Techniq..." ], "media": [], "model": "code", "number": 0, "answer": "#include <bits/stdc++.h>\n\nusing namsepace std;\n\nint main() {\n}" },

[note model] based on fields=[ {"name": "CategoryTag"}, {"name": "OrderNumber"}, {"name": "Front"}, {"name": "Back"}, {"name": "Answer"}, {"name": "MyMedia"}, ],