Erroneous characters added to RTL cloze deletions

Continuation of this thread:
https://anki.tenderapp.com/discussions/ankidesktop/40443-improper-location-of-c1foo-on-ltr-text-in-an-rtl-cloze-field

Anki 2.1.30 adds \x202b and \x202c characters to RTL cloze deletions. This is unnecessary and under some conditions breaks the card display on properly-configured devices. I believe that early Anki 2.0 builds did not have this problem.

The problem is most manifest when the cloze consists of neutrally-directional characters. Example sentence:
מייל אחד בערך 1.6 קילומטר.
The 1.6 should be a cloze deletion, but the display is broken in 2.1.30 due to the \x202b and \x202c characters.

Please remove the misfeature of adding these characters. They are not necessary under any conditions and cause problems under some conditions.

I understand that one user had a problem with the display in the editor. I suspect something misconfigured on their end. I have used Anki with Arabic and Hebrew (and three LTR languages) without issue on Linux desktops and Ankidroid without issue before this came up.

@abdo any thoughts? They appear to have been originally added back on https://anki.tenderapp.com/discussions/ankidesktop/24292-mixed-arabic-and-english-words, and I don’t know enough about RTL to know what is correct here.

The screenshots below show how clozes display with/without these characters and point to the correct display:

  • w/: incorrect; 1.6 should be inside the cloze deletion.
    anki-rtl-1

  • w/o: correct.
    anki-rtl-2

  • w/: incorrect.
    anki-rtl-3

  • w/o: correct.
    anki-rtl-4

  • w/: correct.
    anki-rtl-5

  • w/o: incorrect.
    anki-rtl-6

Without the characters, the display is only messed up with text of mixed directionality in some cases (as in the last example, similar to the one given by the poster here).

This is the case even with Web browsers like Firefox and Chrome as shown below:
image

image

I think handling this case is complicated. I know of no application that does it correctly.
So I agree with the OP that these characters are unnecessary.

Edit: Actually, this is the expected behavior, since the neutral (or weak, more accurately) block 39 comes after the LTR block c1::, it takes the directionality of the previous block (LTR).

Thank you both for the feedback, I’ll get rid of them.