I suppose you could probably use eval('"\u'+uni+'"') to construct the character. But at that point, why not use String.fromCharCode(2018)?
But at that point, why not use String.fromCharCode(2018)?
Because that will insert the Nko letter "Nya" (U+07E2).
Unicode codepoints are generally given in hexadecimal notation -- as in "\u2018" --, but the argument for fromCharCode is a number, defaulting to decimal. Either add the hexadecimal prefix "0x"
or use the decimal value of this number
thank u Jong and John.
To complete the information provided above, if you need to create your Unicode character from a code given as a string (uni = "2018") you can use something like this:
String.fromCharCode(Number("0x" + uni))
var uni = "2018";
myInsertionPoint.contents = String.fromCharCode(Number("0x" + uni));
myInsertionPoint.contents = "“Hello”, he lied.";
[*] Surprise, surprise. The ESTK Editor does -- and that's not an April Fools' joke.