HTML entities are necessary in attributes! Otherwise it is not valid HTML. This violation most occurs as ampersands in HREF URLs; here are some reasons why you should avoid it:

  • Appendix Item B.2.2 of the W3C's HTML 4.0 specification explicitly tells you to.
  • Section 2.2 of RFC 1738: Uniform Resource Locators tells you to.
  • Section 4.4 of the W3C's XML 1.0 specification tells you that not using entities in an attribute value is "Forbidden".
  • Any programs that parse using a validating parser will choke on unescaped character entities.
  • XML makes it clear that there is very little difference between attribute values and character data in a tag. Therefore it should be possible to move CDATA from one to the other without additional parsing.
  • According to a discussion on the W3C's HTML mailing list in February of 1998, the only known browser that doesn't parse HTML entities in attribute values correctly is Amaya 1.1c Beta.

Please, for the sake of the children, use HTML entities in your attribute values.