Ankiweb and AnkiDroid do not display images containing # (pound, hashtag, sharp symbol)

I’ve made many cards for studying music notation containing images with file names like:

Key_A_Major_f#_minor.png

This file name works fine in the Windows desktop app, but ankiweb and AnkiDroid are both unable to display the image.

The desktop app replaces the # sign with %23, but ankiweb and AnkiDroid keep the # as a # when sourcing the image using html.

Desktop: img src=“Key_A_Major_f%23_minor.png”
ankiweb/AnkiDroid: img src=“Key_A_Major_f#_minor.png”

Is there a clever workaroud to rename all the image file names and cards that use those files to not include the # symbol?

1 Like

It might be a good time to consider that the musical sharp character is not #. That seems like it would be an effective substitution (since it’s not a special/protected character), but the other obvious one is the word sharp.

If Desktop is changing the img tag to %23 when you attach the file – isn’t it also changing the name of the actual file that it adds to collection.media? In which case, when you sync the other platforms, they should be getting the img tag in the note, and the attached media file that also say %23. Are all of your platforms in sync? Or are you saying that when the other platforms get the img tag wtih %23, they are changing it back to #, which then doesn’t match the attached filename?

1 Like

Thanks for the ♯ suggestion, I didn’t realize it was it’s own character, I’ll definitely try that in the file names.
The real question is if there is a way to rename all the offending cards at once without breaking all the cards vs. changing each card individually.

It does not change the name of the file in the media folder, it only changes the HTML text on the Desktop app, which is not reflected in Web or AnkiDroid when I sync.

My understanding is %23 is HTML speak for look for a # sign in the file name, so it wouldn’t be changing the actual names of the files. I’m suspecting Anki is actually storing the # sign in the HTML in the database, and only changes it to %23 after it’s read from the database, thus syncing has no effect.

1 Like

This is stranger than I thought. If I change a # sign to %23 in the html in the AnkiDroid app, then sync, that change carries over to the windows app, but then if I’m browsing through the Windows app cards and click in the field that has the HTML text, Windows changes it back to a # in the sort field, but the HTML text remains unchanged:

After changing HTML in AnkiDroid from # to %23 and syncing to Desktop:

After clicking in image field when browsing card then clicking out (Changes %23 back to #, but HTML displayed in edit window never changes):

1 Like

You can use Notes>Find&Replace to adjust multiple cards at once.

This happens because Anki stores filenames without encoding on disk (legacy reasons), but needs to encode them before they’re shown in the editor.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.