Lesson 7
Entities
IntroductionOne of the strengths of HTML is that it can composed and edited in a straightforward text editor. This is also a weakness. What happens, you may ask, if you want to display any of the special characters needed for HTML tags. Characters like '<' and '>'. Well, there is a simple but long-winded way to do so. This method can also be used to display characters not normally accessible. You can also use this method to display email addresses in a way that fools the programs that trawl the Internet gathering addresses for spammers.
The method is to enclose the data for the these special characters within an ampersand and a semi-colon. E.G. < and >. Now that the ampersand is used for special characters, it becomes a special character itself and is represented by &. Alternatively characters can be coded as an ampersand followed by a hash sign, a number and a semi-colon. In the tables below, only the numbers are given.
Another entity which should be mentioned is the pound sign, £, which is written as '£'.
Some special characters
Here are some special characters which are not really available in any other way!
| char | name | hex | dec |
| © | copy | xa9 | 169 |
| ® | reg | xae | 174 |
| ° | deg | xb0 | 176 |
Using special characters as a code for email addresses
Spammers use programs that scan web pages on the Internet for email addresses. They look for alpha-numeric characters and for the 'at' character, i.e. '@'. Coding these characters makes these programs miss the addresses. I used to use the codes shown in the table below, alternating the decimal and hexadecimal versions, in case spammers catch on to this trick.
I understand that entities are no longer safe for displaying email addresses and so in future email addresses on this site are displayed in the form of graphics.
|
|
|
|
|
|
Now decode the following:
&x57;&101;&x6c;&108;&x20;&68;&x6f;&110;&65;
| Previous Lesson |