ijgnd / anki21__editor_add_hyperlink

5 stars 7 forks source link

addon fails to correctly parse urls with double quotes #2

Closed qgerman2 closed 1 year ago

qgerman2 commented 5 years ago

when the url of a hyperlink has double quotes (%22) like this one https://resources.allsetlearning.com/chinese/grammar/Expressing_close_possession_without_%22de%22 the resulting html (ctrl + shift + x in edit field) ends up like this <a href="https://resources.allsetlearning.com/chinese/grammar/Expressing_close_possession_without_"de"">Expressing close possession without "de"</a>&nbsp;(A1) which has twice the quotes and when clicking on it on a card, fails to correctly redirect to the given url. a workaround is to replace the first and last double quotes with single quotes, like so <a href='https://resources.allsetlearning.com/chinese/grammar/Expressing_close_possession_without_"de"'>Expressing close possession without "de"</a>&nbsp;(A1)

ijgnd commented 5 years ago

Thanks for your report.

I'm not sure if this is a problem of this add-on or a problem of Anki in general: Start Anki without any add-ons (by holding down shift during startup). Then open the Add-Window. Open the html source code view for one field. It is empty. Then paste this <a href="https://resources.allsetlearning.com/chinese/grammar/Expressing_close_possession_without_%22de%22">link</a>. Then close the html source view window. Then open it again. On my machine the %22 part is no longer there. Instead I have ".

If you also have this in your anki without any add-ons maybe ask in the official forum at anki.tenderapp.com. There are some similar discussion from the past about url encodings like https://anki.tenderapp.com/discussions/ankidesktop/19047-url-encoding-in-href-field-not-preserved-for-23 which didn't help me.

I'll have to learn more about url encodings and how they behave in anki. I'm afraid this might take a while.

ijgnd commented 1 year ago

this was fixed in Anki itself since at least Anki 2.1.21 from 2020-03-09.

The Anki editor still transformed %22 in Anki 2.1.15