How to show Unicode characters in IE using HTML

18,518

Solution 1

Entities need a semi-colon:

©

Firefox is being incorrectly over-helpful in this case.

Solution 2

  1. Use decimal values.
  2. Always terminate entity with ; (semicolon) even in context, where it's optional.
  3. 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.

Share:
18,518
Mikle
Author by

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, 2022

Comments

  • Mikle
    Mikle almost 2 years

    I'm trying to show the copyright and infinity signs at the bottom of my page using this code:

    &#x00A9 Copyright Mikle 2009 - &#x221E
    

    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
    Mikle about 15 years
    This works but hex is a part of unicode, so I'll use the second method.
  • Mikle
    Mikle about 15 years
    Well, it seems like a stupid requirement, since it's not a common phrase ("Hello my friend &#x00fe!"), why does it HAVE to look for ;? Seems like unnecessary complexity.
  • vartec
    vartec about 15 years
    Would you care to elaborate on that?
  • Rahul
    Rahul about 15 years
    It'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
    vartec about 15 years
    Of 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.