HTML and CSS Reference
In-Depth Information
Character Encoding
Character encoding
associates each symbol from a character set with a numeric value
called the
numeric character reference
. For example, the copyright symbol © from the
UTF-8 character set is encoded with the number 169. If you know the character encod-
ing number, you can insert the corresponding character directly into your Web page
using the entity
&#
code
;
where
code
is the encoding number. Thus, to display the © symbol in your Web page,
you would enter
©
into your HTML fi le.
Character Entity References
Another way to insert a special symbol is to use a
character entity reference
, which is
a short memorable name used in place of the encoding number. Character entity refer-
ences are inserted using the syntax
&
char
;
where
char
is the character's entity reference. The character entity reference for the
copyright symbol is
copy
. So to display the © symbol in your Web page, you could insert
©
into your HTML code.
Inserting Symbols from a Character Set
• To insert a symbol based on the encoding number, use the entity
&#
code
;
where
code
is the encoding number.
• To insert a symbol based on a character entity reference, use the entity
&
char
;
where
char
is the name assigned to the character.
• To insert a nonbreaking space, use the following entity:
• To insert the
<
symbol, use the following entity:
<
• To insert the > symbol, use the following entity:
>
You can explore various encoding numbers and character entity references by open-
ing the demo page supplied with your Data Files.
To view the demo page:
◗
1.
Use your Web browser to open the
demo_characters.htm
file from the
tutorial.01\demo data folder.
◗
2.
Type
£
;
in the input box and then click the
Show
button. The Web browser
displays the £ symbol in the ivory-colored box below.