How to use five digit long Unicode characters in JavaScript

前端 未结 5 2107

In JavaScript I can do this:

foo = \"\\u2669\" // 1/4 note

But I can\'t do this

foo = \"\\u1D15D\" // full note  -five hex digi         


        
5条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-19 10:34

    I did a little checking and it appears that there is no full note near 0x2669. (table of unicode chars)

    Although using 0x01D15D does give me a unknown unicode character this could be because I don't have a music font though. Javascript will try to parse as byte as it can and 0x1D15D is 2.5 bytes padding it with a 0 will make it 3 and parsable.

    Also this was quite handy: unicode.org/charts/PDF/U1D100.pdf

提交回复
热议问题