You can add a Unicode character to an HTML document by creating an HTML entity from:
- A named character reference — available for most common characters;
- A numeric code reference (either in decimal or hexadecimal) — available for all characters.
For example, the copyright symbol (©) is represented in the following way:
copy;— named reference;
169— decimal numeric reference;
U+000A9— hexadecimal numeric reference.
You can create an HTML entity from any of these in the following ways:
©— by adding the named reference between
©— by adding the decimal reference between
©— by adding the hexadecimal reference between
Things to remember:
- All HTML entities begin with an ampersand (
&) and end with a semi-colon (
- For numeric references (i.e. both, decimal and hexadecimal) you must add a hash (
#) after the ampersand (
- For hexadecimal references you must also prefix the hexadecimal number with
xto indicate that the numbers that follow should be interpreted as hexadecimal;
- For hexadecimal references, you may have noticed that
U+000was omitted from the entity. This is because
U+is merely used as a convention to denote that the hexadecimal digits that follow are Unicode code points, and this is never added to the HTML entity. The leading zeros, however, are optional to add.
Hope you found this post useful. It was published . Please show your love and support by sharing this post.