All emojis are pretty much standardized with the format at Emoji Cheat Sheet, so your given example above (\01F683
) maps to railway_car
in the Emoji Cheat Sheet.
It might be a better idea to store your emojis with these identifiers and map it to the actual emojis later on, without worrying about encoding the actual emoji (π) themselves, or not being able to tell/remember the actual emoji represented by the Unicode sequence (\01F683
).
If you wish to map this human-readable identifier to the actual Unicode sequence/symbol itself, you have a few options, using railway_car
as an example:
Twemoji Awesome
Twemoji Awesome is like Font Awesome, but with Twitter Emojis.
You can then insert an emoji like this, just like Font Awesome.
<i class="twa twa-railway-car"></i>
This will output the corresponding SVG:
Emoji Dictionary
There's an npm package aptly named emoji-dictionary
that allows you to map the emoji name to the Unicode character, if you wish to use default the browser's default emoji renderer.
The usage will then look like this:
emoji.getUnicode("railway_car");
This returns π (which would display on modern browsers/might break on older browsers/etc).
::after
(two colons). If your CSS is served with the correct encoding specified in the Content-Type header or@charset
declaration, you can also just use the emoji directly (.smiley::after { content: 'π'; }
). Related: #10393962 β Dunt