It make sense to use entity names for describing <a> as per shown below code.

<!doctype html>
        <title> My First Webpage</title>
        <meta charset="utf-8" />

As per this w3link, I am not sure,

Why would I require entity names to specify/type characters like ¥ ¢ © ® , when the above code already supports utf-8

        <meta charset="utf-8" />

standard where these characters are part of the Unicode planes?

  • 8
    Who said it is required? – Oded Feb 19 '15 at 11:37
  • What if your <meta> tag lies, because your website admin doesn't know that you use UTF-8? – kdgregory Feb 19 '15 at 15:40

Those entities were created in the first place for two reasons:

  • Originally, UTF-8 wasn't that ubiquitous: many HTML files were stored using other encodings which easily led to problems when you had to use special characters. By using HTML entities, you were sure they are displayed correctly, no matter what encoding you use.

  • Those entities make it easy to add them to a page without having to remember the Unicode identifier. What's faster among the following alternatives:

    1. To type &copy; in your favorite editor,
    2. To type &#169; or &#x00A9; (the second representation may not be supported in older browsers),
    3. To type Alt+169,
    4. To run charmap and search for the "©" character,
    5. To open a random web page hoping it will contain the copyright symbol in its footer and copy-paste it.

    Obviously, the third one is the fastest, and obviously, every developer remembers that 169 is the decimal representation of the Unicodde © symbol, as everyone remembers the codes corresponding to the quotes “”, mid-dots ·, and a few dozen or hundred of other useful symbols. The second alternative has the same issue.

    Which keeps us with three other alternatives. The fourth one takes time. The fifth one may be a bit faster, but still not as fast as typing &copy;.

While the first reason may be a bit obsolete, the second reason is still valid. This being said, using Unicode characters instead of their HTML representations is a perfectly valid choice and has in turn two benefits:

  • Readability. If I don't know which code corresponds to which symbol, maintaining HTML full of HTML entities won't be easy.

  • Size. Shorter HTML means less bandwidth used. Very probably, it doesn't make too much difference, but still.

  • In java files, we use \uxxxx notation to specify Unicode characters to avoid your third and fourth option.in html do we have such facility? – overexchange Feb 20 '15 at 3:43
  • @overexchange: yes; I edited my answer, see point 2. For instance, for the copyright symbol, you can use &#169; or &#x00A9;. – Arseni Mourzenko Feb 20 '15 at 4:00
  • So, Why concept called entity number or entity name is introduced for only characters ¥ ¢ © ® when you are fine to represent Unicode encodings &#x00A9 for a character like ¢. We would require entity name concept only characters like < or > because the parser that parses my html file could not differentiate the html tag and text. – overexchange Feb 20 '15 at 9:17

The simple answer is: you don't need HTML entities for anything other than "&" (ampersand), single/double quotes, "<" and ">". The other HTML entities are optional, not required.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.