Sunday, May 6, 2018

Is It Safe To Use Unicode Literals in HTML?

Leave a Comment

I am making an application, and I want to add a "HOME" button.

After much struggling with various icon libraries, I stumbled upon this site,

http://graphemica.com/%F0%9F%8F%A0, with this

🏠

A unicode symbol, which is more akin to a letter than an image.

I pasted it into my HTML, and it just workedTM.

All this seems a little too easy, though. Are unicode symbols widely supported? Is there some kind of problem with them that leads people to use icon libraries instead?

2 Answers

Answers 1

It depends on what do you mean for "safe".

User should have the fonts, so you must include the relative font, and in various formats: there is not yet a format recognized by most used web-browsers.

Additionally, font with multiple colours are not fully understood by various systems, so you should care about what do you expect from users (click, select, copy, etc.).

Additionally, every fonts has own design, so between different fonts (so browsers and operating system) things can look differently. We do not have yet a "Helvetica 'Home'", a "Times New Roman 'Home'".

All this points, could be solved by using a web font, with monochrome glyphs (but it could be huge, if it includes all Unicode code points (+ usual combinations).

It seems that various recent browser crashes if there are many different glyphs, but usually it should not be a problem.

I also recommend aria stuffs so that you page could be used also by e.g. readers (and braille screen).

Note: on the plus side, the few people that use text browser can better see the HOME (not the case in case of an image), if somebody still care about this use case.

Answers 2

Here are few precautions to be taken while doing that, I did some research and found this to be more helpful for your question. Also I dont know how you can do but credits go to Mr.GOY

Displaying unicode symbols in HTML

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment