Converting unicode character to string format

后端 未结 5 2204
失恋的感觉
失恋的感觉 2020-11-30 07:44

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

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

5条回答
  •  迷失自我
    2020-11-30 07:52

    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.

提交回复
热议问题