Showing unicode in source files?


I need a unicode right arrow for a package I’m doing . I don’t know what codes are safe to use in the programming fonts. Can everyone copy and paste the text below into any atom editor tab and tell me which characters show or don’t show? The name of the font and what OS would also be useful. Thanks in advance.

21d2: ⇒   
21e8: ⇨   
21db: ⇛   
21a0: ↠   
2192: →   
21a6: ↦  
21a3: ↣


They all show for me. Font: Source Code Pro


I’ve done a bit of research on programming fonts. Some very popular fonts cover very few glyphs. Inconsolata only has 291 for instance. If the OS fails to find the proper glyph, it will search for it in another font as this screenshot demonstrates (thank god for that feature in Chrome by the way):

Inconsolata doesn’t have the arrow glyph, but Arial does and fills in. Source Code Pro has better coverage, but also misses the arrows, so on @leedohm’s system the same thing happens.

So what you need to know isn’t necessarily the programming font used, but it goes all the way down to the entire set of fonts available on a given system. There isn’t really a way to be sure, although most systems will have a font like Arial in there somewhere to make these glyphs show up.

If you need to be sure, and need to be sure some proportional font doesn’t mess with the measurements and code alignment/indentation (in Arial 2192 is much wider than 21a6), you could look into serving a font along with your package. There are a number of free (and very good) options that cover enormous amounts of glyphs, like DejaVu.


Awesome. Thanks for this.

Luckily my package will still work if the glyph is missing and it shows the ugly missing-glyph. Indentation doesn’t matter much either.

BTW: This is for a worksheet that allows entering expressions in a text editor. Any expression found in the text is evaluated and the result is appended proceeded by this arrow. I need the arrow character code to be something not found in source code so I can find it. The text is never compiled or used by any other app so the code doesn’t hurt anything.


Sounds like you’re good then :+1: