24 October 2005

Numeric Entities

In my previous post, I couldn't show the actual HTML codes because they confused the Blogger form. I had to use double open parenthesis ( (( ) to represent open angle bracket ( < ) and so on to show the "codes". It was a pretty lame solution and bothered me so much I dug into my ancient Teach Yourself Web Publishing With HTML 3.2 to find a better solution. I thought there should be some tags that would tell the browser to ignore everything below. I used the remark tag <!-- and --> but then the whole thing would be hidden. I would have to add a note telling my visitors to view the source code to copy it. Not nice.

In the end, the answer is to use numeric entities to represents characters that would normally be interpreted as markup language. < is represented as &#60, > by &#62, and so on. Enjoy!