How to show Unicode characters in IE using HTML
Solution 1
Entities need a semi-colon:
©
Firefox is being incorrectly over-helpful in this case.
Solution 2
- Use decimal values.
- Always terminate entity with ; (semicolon) even in context, where it's optional.
- Use named entity whenever possible. Your example entities should be written
©
© and∞
∞
Other approach, is to forget about entities, and just put plain UTF-8 character there.
Solution 3
Can't you use "©
" ?
This page has a list of HTML codes for common symbols.
Mikle
I was an aspiring Pythonista, a C# guy at work, and generally a code ape who likes nothing more than researching some obscure API to make cool stuff happen, and to get bored after I succeed. Currently I'm in love with Django and I work part-time at Zimperium. The last bit of the previous description is still true, but I try and create products before I get bored of them, so that's progress over the last 4 years, right?
Updated on June 11, 2022Comments
-
Mikle almost 2 years
I'm trying to show the copyright and infinity signs at the bottom of my page using this code:
© Copyright Mikle 2009 - ∞
This works perfectly in Firefox 2, 3 and Chrome. IE7 though, is showing me the actual codes (like you see above) instead of what I expect and the other browser show:
© Copyright Mikle 2009 - ∞
This is probably some stupid thing, but this is making me understand why IE is getting so much hate. How do I fix this?
-
Mikle about 15 yearsThis works but hex is a part of unicode, so I'll use the second method.
-
Mikle about 15 yearsWell, it seems like a stupid requirement, since it's not a common phrase ("Hello my friend þ!"), why does it HAVE to look for ;? Seems like unnecessary complexity.
-
vartec about 15 yearsWould you care to elaborate on that?
-
Rahul about 15 yearsIt's part of the html recommendation, and the html recommendation prefers completeness (leading to simpler parsers) over assumptions. The irony here is that you assumed IE was at fault, when it was in fact IE that was strictly adhering to the "standard". ;-)
-
vartec about 15 yearsOf course that has it's advantages and it's disadvantages. But then again, UTF-8 is the current standard and all RFCs recommend using it. We shouldn't stay in 1960's just because someone might screw up.