Things you always forget: XML Character Entities

Certain characters break XML or need to be escaped in HTML so they are rendered literally and not interpreted themselves as markup. There’s a few predefined character entities that are commonly used:

  • &lt;      :     <
  • &gt;     :     >
  • &amp; :    &

For other characters though, you sometimes need to use their Unicode encoded value. For example to literally display { and } in a JSP or JSF page (since they are used in EL syntax ${} and #{} ), you can use their unicode values like this:

  • &#x007b;     :     {
  • &#x007d;     :     }

There’s many unicode ref charts online, here’s one that I’ve used:

http://en.wikibooks.org/wiki/Unicode/Character_reference/0000-0FFF