Search code examples
javascriptunicode

Converting unicode character to string format


Does anyone know how to convert a unicode to a string in javascript. For instance:

\u2211 -> ∑ \u0032 -> 2 \u222B -> ∫

I basically want to be able to display the symbol in xhtml or html. Haven't decided which I will be using yet.


Solution

  • Just found a way: String.fromCharCode(parseInt(unicode,16)) returns the right symbol representation. The unicode here doesn't have the \u in front of it just the number.