# HTML problem Unicode char only when color

**URL:** <https://forums.ankiweb.net/t/html-problem-unicode-char-only-when-color/2915>\
**Category:** Help\
**Created:** [September 1, 2020, 3:10pm UTC](https://forums.ankiweb.net/t/html-problem-unicode-char-only-when-color/2915 "2020-09-01T15:10:24Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![n8abx](https://avatars.discourse-cdn.com/v4/letter/n/bc79bd/32.png) [@n8abx](https://forums.ankiweb.net/u/n8abx)\
**Post date:** [September 1, 2020, 3:10pm UTC](https://forums.ankiweb.net/t/html-problem-unicode-char-only-when-color/2915/1 "2020-09-01T15:10:24Z")

</div>

Version 2.1.33 (3f403040) - error already in previous version  
Python 3.8.0 Qt 5.14.1 PyQt 5.14.1  
Windows 10

I discovered a weird HTML error both in preview and in the card when reviewing.  
I found a nice unicode char “✔” and “✗”, and used them on a card. No problem. Everything works fine.

BUT when I colour the char (green / red) suddenly I get an HTML error.

Minimal example (card HTML, works fine, also with additional text, same with second char above):  
`✔`

Minimal example (card HTML, HTML ERROR, also with additional text, same problem occurs with second char above):  
`<font color="#ff0000">✔</font>`

Error message:  
Invalid HTML on card: SyntaxError: Unexpected identifier  
SyntaxError: Unexpected identifier  
at eval ()  
at 127.0.0.1:63984/\_anki/jquery.js:2:2651  
at Function.globalEval (127.0.0.1:63984/\_anki/jquery.js:2:2662)  
at Ha (127.0.0.1:63984/\_anki/jquery.js:3:21262)  
at n.fn.init.append (127.0.0.1:63984/\_anki/jquery.js:3:22791)  
at n.fn.init. (127.0.0.1:63984/\_anki/jquery.js:3:24070)  
at Y (127.0.0.1:63984/\_anki/jquery.js:3:4515)  
at n.fn.init.html (127.0.0.1:63984/\_anki/jquery.js:3:23660)  
at HTMLDivElement. (127.0.0.1:63984/\_anki/reviewer.js:33:16)  
at HTMLDivElement.d.complete (127.0.0.1:63984/\_anki/jquery.js:4:6203)

Why is the colour such a problem? I tried to change the font-tag into div or span, but it doesn’t help. What do I need to do to avoid this error? Thx.

P.S. I had to delete all the protocol http from the error message because I was not allowed to post with all those links.

P.P.S. It looks fine in the editor without any error message.

---

<div class="post-metadata">

**Author:** ![abdo](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/abdo/32/654_2.png) [@abdo](https://forums.ankiweb.net/u/abdo)\
**Post date:** [September 1, 2020, 3:35pm UTC](https://forums.ankiweb.net/t/html-problem-unicode-char-only-when-color/2915/2 "2020-09-01T15:35:53Z")

</div>

Works for me.  
This is probably an issue with your templates. Click `Cards` in the editor screen and inspect the HTML of your front and back templates.

---

<div class="post-metadata">

**Author:** ![n8abx](https://avatars.discourse-cdn.com/v4/letter/n/bc79bd/32.png) [@n8abx](https://forums.ankiweb.net/u/n8abx)\
**Post date:** [September 1, 2020, 3:36pm UTC](https://forums.ankiweb.net/t/html-problem-unicode-char-only-when-color/2915/3 "2020-09-01T15:36:29Z")

</div>

Thx. What would I be looking for in my template?

---

<div class="post-metadata">

**Author:** ![abdo](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/abdo/32/654_2.png) [@abdo](https://forums.ankiweb.net/u/abdo)\
**Post date:** [September 1, 2020, 3:40pm UTC](https://forums.ankiweb.net/t/html-problem-unicode-char-only-when-color/2915/4 "2020-09-01T15:40:49Z")

</div>

Look for invalid HTML code (`div` elements specifically).

You can post the templates content here so we can help you.

Use the `Preformatted text` option to paste the content here.  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/2X/4/462f9808c1ceb667963e45243ee05ac5ed8620fd.png)

---

<div class="post-metadata">

**Author:** ![n8abx](https://avatars.discourse-cdn.com/v4/letter/n/bc79bd/32.png) [@n8abx](https://forums.ankiweb.net/u/n8abx)\
**Post date:** [September 1, 2020, 4:38pm UTC](https://forums.ankiweb.net/t/html-problem-unicode-char-only-when-color/2915/5 "2020-09-01T16:38:42Z")

</div>

Thx.

I didn’t find the problem yet (maybe post code later) but as a first step I downgraded back to Version 2.1.26 (70784154) because the newest Version causes problems on almost all cards and the slightly older one doesn’t. (I also don’t like the new template editor.)

---

<div class="post-metadata">

**Author:** ![n8abx](https://avatars.discourse-cdn.com/v4/letter/n/bc79bd/32.png) [@n8abx](https://forums.ankiweb.net/u/n8abx)\
**Post date:** [September 27, 2020, 5:17am UTC](https://forums.ankiweb.net/t/html-problem-unicode-char-only-when-color/2915/6 "2020-09-27T05:17:15Z")

</div>

I’m still not sure why there should be any invalid HTML in the process as I only read content from divs that contained {{text:myfield}}. For the time being I deleted most JS in this note type and it works again.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/1X/8f1279ababc5879d54e4838989f606cfe55af8c7.jpeg) [@system](https://forums.ankiweb.net/u/system)\
**Post date:** [May 1, 2023, 5:29am UTC](https://forums.ankiweb.net/t/html-problem-unicode-char-only-when-color/2915/7 "2023-05-01T05:29:29Z")

</div>


