slayeroffice - web experiments gone horribly awry

02.23.2006 - Unicode Lookup

Several folks have contacted me since publishing Alternatives to innerHTML asking how to create special characters with createTextNode.

If you were to use document.createTextNode("&"); you will literally get & written to the document rather than the ampersand you are looking for. The answer is to use the Unicode hex value for the character: document.createTextNode("\u0026");.

I wasn't able to turn up any reasonably useful charts of the codes, so to make this a bit easier I've thrown together a quick application that will do the lookup for you. Just type in the ASCII integer value or the character itself and it will present you with the Unicode hex value.

A good unicode page I found the other day... <a href=""></a>
Posted by Aaron Barker on February 23, 2006 @ 8:09 pm
Curses... foiled again. You need to put a note about HTML is not allowed in comments or something.

Here's a cleaner line to copy:
Posted by Aaron Barker on February 23, 2006 @ 8:10 pm

See, thats the sort of chart I would have *liked* google to have turned up for me. Oh well...

"No HMTL Allowed" added ;)
Posted by Steve on February 23, 2006 @ 8:54 pm

Just as a note, the backslash before u in the Unicode character escape doesn't show up in Bloglines. I'm not sure whether that's your RSS feed or Bloglines doing it.
Posted by Stuart Langridge on February 24, 2006 @ 8:33 am
Thanks Stuart - fixed.
Posted by Steve on February 24, 2006 @ 3:07 pm
For Mac users, Unicode Font Info [1] is a free tool which provides Unicode and HTML information and allows you to check out which glyphs are present in the fonts on your system. Very handy indeed.

Posted by Richard Rutter on February 25, 2006 @ 10:59 am

Cool page Arron and never noticed the change in Bloglines but way cool fo rStuart pointitng that out.
Posted by Britney on March 10, 2006 @ 8:36 pm
Thanks, been looking for this for AGES!! You're a life saver!!
Posted by Daniel on March 12, 2006 @ 9:59 pm

Comments have been closed for this post.