![]() |
Home | About |
|
Character SetsA character set is a list of characters that may appear in a document, and a character encoding is a way of storing these characters on a computer as bits.
When developing HTML documents you must specify the encoding you wish to use, e.g.
For HTML5, the default character encoding is UTF-8. This should be declared in the HTML <meta> tag as: <meta charset="UTF-8">
For HTML 2.0 to HTML 4.01, the default character encoding is ISO-8859-1. This should be declared in the HTML <meta> tag as: <meta http-equiv="Content-type"
content="text/html; charset=iso-8859-1">
Character referencesCharacter references allow web authors to refer to characters using either:
Character entity referencesCharacter entity references allow you to use a simple, memorable name instead of a number to refer to a character. The benefits are:
The disadvantages are:
The first character entity references were introduced with HTML 3.2 for ISO Latin-1 characters. In HTML 4, the list was extended to include symbols, mathematical symbols and Greek letters plus markup-significant and internationalisation characters.
The syntax for a character entity reference is an ampersand (&) followed by the name of the entity, followed by a semi-colon (;) , e.g.:
<p>© Cloford.com.</p> is displayed as: © Cloford.com.
Numeric character referencesNumeric character references use a number to refer to a character in the document character set. The number can be either a decimal or hexadecimal number. The benefits are:
The disadvantages are:
The syntax for numeric character references is an ampersand and a hash mark (&#), followed by a number in decimal, or the letter "x" and a number in hexadecimal, followed by a semi-colon (;) , e.g.:
<p>‰ or ‰ displays the "per mille sign".</p> This is displayed on the screen as: ‰ or ‰ displays the "per mille sign".
|
© 2000 cloford.com. All rights reserved. | Terms and Conditions. | Privacy Policy. | ![]() |