Reputation: 513
Running react application. I want to convert a Unicode string into emoji. But the problem is that charset related to browser convention.
For example:
Input
'🗿 - nice emoji!'
Output
🗿 - nice emoji!
Is there any convenient way to do it?
Upvotes: 0
Views: 644
Reputation: 5745
your string can be converted that way :
String.fromCodePoint(128511)
>>> "🗿"
also your specific emoji has hex code 0x1F5FF
:
`${ String.fromCodePoint(0x1F5FF)} - nice emoji!`
>>>"🗿 - nice emoji!"
you can search for hex code in this table
you can yuse whatever you prefer.. just covert the number after th '&#' with String.fromCodePoint()
...
Upvotes: 1