Converting unicode character to string format
A function from k.ken's response:
function unicodeToChar(text) {
return text.replace(/\\u[\dA-F]{4}/gi,
function (match) {
return String.fromCharCode(parseInt(match.replace(/\\u/g, ''), 16));
});
}
Takes all unicode characters in the inputted string, and converts them to the character.
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.
To convert an given Unicode-Char like to String-Representation, you can also use this one-liner:
var unicodeToStr = ''.codePointAt(0).toString(16)
The above example gives you 'F21D'. Used with fontAwesome, you get street-view Icon: '\F21D'