kol
kol

Reputation: 28728

HTML - Missing Unicode characters

I have a page which contains some HTML-encoded Unicode characters: ▲ (▲), ▼ (▼), ◄ (◄), ► (►) and ✓ (✓). Some users complain about some of these not showing up in their browser.

What is the best way to solve this without installing fonts on the users' machines? Do I have to make bitmaps for each Unicode character? If yes, is there a tool to convert characters to bitmaps? Or is there a better way?

Upvotes: 1

Views: 3400

Answers (2)

Jukka K. Korpela
Jukka K. Korpela

Reputation: 201886

As this is primarily a font problem, the alternatives are to use a downloadable font, also known as web font, via @font-face, and to use images instead of characters. I wrote “primarily”, because there is an additional difficulty: some browsers will not display some characters unless they can be found in the fonts listed in the applicable font-family list. For generalities on these issues, see my Guide to using special characters in HTML.

In this special case, the character “✓” may cause problems since it is present in relatively few fonts. I would expect the others to be OK in most cases, but my expectation was wrong: Android (2.x) shows ▲ and ▼ OK, but not ◄ and ►.

Using a downloadable font to get such characters rendered might be overkill, so it might be best to use images. You can just write the character in some program using some suitable font in large size, take screen captures of each, and save them as images. Then you would use them via img tags, setting the heights of the images to suitable height in CSS, using the em unit. The reason is that this way they will look good in different font sizes – adapting to font size, and scaling downwards tends to produce better results than scaling upwards.

If you take this way, then it is best to represent all of ▲, ▼, ◄, ► as images, to make them stylistically matching.

Upvotes: 4

Cowwando
Cowwando

Reputation: 460

Simply use UTF-8 for encoding of your pages and in case some fonts are missing those symbols use Arial, because it contains them all.

Upvotes: -3

Related Questions