Abe Fehr
Abe Fehr

Reputation: 738

Unicode displaying inconsistently when escaped in JS vs HTML

I'm trying to insert a musical coda symbol into a <p> element with JavaScript, but it's showing up incorrectly. The musical symbol shows up completely fine when it's HTML-escaped however. What is the reason for this inconsistency?

http://jsfiddle.net/4m3kLtk5/3/

PS: It happens on Chrome and Firefox on my Mac, but I haven't yet had the chance to test it on any other browsers.

Upvotes: 0

Views: 32

Answers (1)

NendoTaka
NendoTaka

Reputation: 1224

Try using x.innerHTML = '\uD834\uDD0C'; this should work. The code for the character should be \uD834\uDD0C instead of \u1d10c

Upvotes: 1

Related Questions