An importer bug

Hello. I’ve found a bug in its importer. When you import CSV files and the sort fields have ampersands (&), it cannot handle these entries appropriately, and shows as conflicting cards, and even starts duplicating when read the same CSV again. I put an example CSV below. There are 6 entries in this CSV. Import it and open your browser, and you’ll notice these cards are showed as conflicting. From 3rd to 6th entries, they can fix this situation by just selecting (dragging) text on your browser, not needed any rewriting operations. After you select (or drag) the text, which is colored red because of the confliction, the background turns into white, and Anki recognizes they aren’t conflicting. But 1st and 2nd entries aren’t corrected with these actions. They need to delete and re-write any letters.

1234567890 & 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890a,a,a
1234567890 & 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890b,a,a
1234567890 & 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890a,
1234567890 & 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890b,
1234567890 & 1234567890123456789012345678901234567890123456789012345678901234567890a,
1234567890 & 1234567890123456789012345678901234567890123456789012345678901234567890b,

I’m not quite sure I understand your problem and something might have gone wrong with your example. Or is it supposed to look like that?
But Anki is definitely handling "&"s inconsistently. Are you importing as HTML? If so, there shouldn’t be any raw ampersands in your text. You can use an online tool to convert them into proper HTML entities (&) and see if that makes a difference for your problem.

Thank you for your message. I wanted to say that Anki doesn’t seem to be handling ampersands correctly. And yes, I am importing CSVs as HTML. I usually make cards that have a sort field containing book names. And now I have been making cards for a book which has “&” in its name. I have already tried &, but the result was the same.

But thank you for the information that Anki is not good at ampersands. I will import “ampersand” strings and replace them with “&” for the time being. :grinning:

So I’ve tried to reproduce the issue on the latest release. And indeed, when I import an existing note containing raw &s, it’s not recognised as a duplicate. However, it works fine when I use &s.
Also, it seems to have been fixed on the main branch, even though it’s not exactly a bug: Since you tell Anki that you import HTML, it will be checked against raw HTML, i.e., "&"s on existing notes will be expanded to "&"s, but "&"s in the csv file will not, so the content won’t match.

If you still can reproduce the issue on the latest release and with well-formed HTML, I’d be interested to know.

1 Like