Disappearing HTML dingbat entities
I'm coming across a weird issue with displaying "dingbats" html entities, specifically ✔
(✔). I am trying to display 开发者_StackOverflow社区some checkmarks, wrapped in a simple <span>
:
<span style="font-family: serif; font-size: 200%">✔</span>
This is working in Firefox 3.6, Chrome and IE8 on my computer, but in Firefox 4 on a coworker's computer, instead of displaying a checkmark, a blank space appears. Strangely, on the same computer, the checkmark appears properly in IE9 and Chrome.
I have tried explicitly specifying other fonts (including: Times New Roman, Arial, "Dingbats"), specifying no specific font, and even not specifying any style information at all, all to no avail. I suppose I could use an image instead, but I wanted the flexibility of being able to style the character without having to create a new image each time.
Any suggestions on how to approach this?
EDIT: This is how this page (with a search for hex 2714) looks for him in...
IE 9:
Firefox 4:
This is a shot in the dark, but I remember reading that some browsers try to "guess" at the character set being used depending on the web server settings, the content, etc. Could the browser be rendering the character using the wrong character set?
Even as I read over my own answer I suspect this may not be the issue... but thought I'd put it out there just in case.
I cannot reproduce the error in FF4.01. However, this might be to do with the fonts installed on your coworker's machine - as has already been suggested. Ask him to set the standard font to "Arial Unicode MS" or "Lucida Sans Unicode" (if these two don't appear in the fonts list, your coworker would have to install them) and see if it works.
If it does, you should consider setting <span style="font-family: 'Arial Unicode MS', 'Lucida Sans Unicode', sans-serif;">
. Although this seems to be a highly machine-specific problem, there is still a chance this might happen on other machines as well.
The character encoding shouldn't have any impact, it should work under ISO-8859-1 as well as UTF-8 to UTF-32 - at least.
It is possible to force a font in some browsers. The user is allowed to specify a desired font. Even if the site uses a specific font it will not be displayed.
Your coworker might have inserted a value for this option.
精彩评论