A Wired.com user account lets you create, edit and comment on Webmonkey articles. You will also be able to contribute to the Wired How-To Wiki and comment on news stories at Wired.com.
It's fast and free.
processing...Retrieve Sign In
Please enter your e-mail address or username below. Your username and password will be sent to the e-mail address you provided us.
processing...Welcome to Webmonkey
- edit articles
- add to the code library
- design and write a tutorial
- comment on any Webmonkey article
Sign In Information Sent
Write Symbols and Special Characters in HTML
/skill level/
/viewed/
m (1 revision(s)) |
|||
| Line 1: | Line 1: | ||
| - | |||
When you type regular letters, numbers, and characters from your keyboard into the body of an HTML document, they show up on your Web pages just as you typed them. But things aren't so easy in non-English speaking countries (and such places do exist - honest). Languages such as French, German, and Icelandic often use characters that are not found on your typical keyboard. Even in English, accents can distinguish a "résumé" from a "resume." | When you type regular letters, numbers, and characters from your keyboard into the body of an HTML document, they show up on your Web pages just as you typed them. But things aren't so easy in non-English speaking countries (and such places do exist - honest). Languages such as French, German, and Icelandic often use characters that are not found on your typical keyboard. Even in English, accents can distinguish a "résumé" from a "resume." | ||
| Line 5: | Line 4: | ||
So how do you make special characters and accented letters show up on your pages? You use a special set of codes called '''character entities''', which you insert into your HTML code and which your browser will display as the corresponding symbols or characters you want. | So how do you make special characters and accented letters show up on your pages? You use a special set of codes called '''character entities''', which you insert into your HTML code and which your browser will display as the corresponding symbols or characters you want. | ||
| - | The most common character entities have been collected by the International Organization for Standardization and compiled in the [[Reference:Special Characters]] ISO Latin Alphabet No. 1 table, which includes special characters, letters with diacritical marks (accents, umlauts, etc.), and scientific and currency symbols. The Latin-1 table contains 255 characters. | + | The most common character entities have been collected by the International Organization for Standardization and compiled in the [[Reference: | Special Characters]] ISO Latin Alphabet No. 1 table, which includes special characters, letters with diacritical marks (accents, umlauts, etc.), and scientific and currency symbols. The Latin-1 table contains 255 characters. |
There are two kinds of entities here:text and numeric. Both kinds begin with an ampersand ( <tt>&</tt>) and end with a semicolon ( <tt>;</tt>). | There are two kinds of entities here:text and numeric. Both kinds begin with an ampersand ( <tt>&</tt>) and end with a semicolon ( <tt>;</tt>). | ||
| Line 12: | Line 11: | ||
<pre> | <pre> | ||
| - | "The | + | "The © symbol stands for 'copyright.'" |
</pre> | </pre> | ||
| Line 18: | Line 17: | ||
<pre> | <pre> | ||
| - | "The © symbol stands for 'copyright.'" | + | "The &copy; symbol stands for 'copyright.'" |
</pre> | </pre> | ||
| - | Numeric entities are similar to text ones, but should be written in this form:<tt>&#x;</tt> - where the "x" represents a number between 0 and 255. It is very important to make sure that the <tt>#</tt> symbol precedes the number, or the entity will not work. So to make "The | + | Numeric entities are similar to text ones, but should be written in this form:<tt>&#x;</tt> - where the "x" represents a number between 0 and 255. It is very important to make sure that the <tt>#</tt> symbol precedes the number, or the entity will not work. So to make "The ��� symbol stands for 'copyright.'" with a numeric entity, your HTML would look like this: |
<pre> | <pre> | ||
| - | "The © symbol stands for 'copyright.'" | + | "The &#169; symbol stands for 'copyright.'" |
</pre> | </pre> | ||
| - | As you can see, some characters (like | + | As you can see, some characters (like ©) can be represented by either a text or a numeric entity. |
A note of caution here:Many computers let you use keyboard shortcuts to create accented letters and special characters (for example, typing <tt>option</tt> + <tt>e</tt> will produce "é"). Beware, the shortcuts may not always work. The browser may read the character you created differently or not at all. This occurs because the code that is used to represent the character on the keyboard does not directly translate into Latin-1 and probably won't be read by your Web browser. | A note of caution here:Many computers let you use keyboard shortcuts to create accented letters and special characters (for example, typing <tt>option</tt> + <tt>e</tt> will produce "é"). Beware, the shortcuts may not always work. The browser may read the character you created differently or not at all. This occurs because the code that is used to represent the character on the keyboard does not directly translate into Latin-1 and probably won't be read by your Web browser. | ||
| - | Sometimes, case can also be important. For example, <tt>é</tt> produces the <tt> | + | Sometimes, case can also be important. For example, <tt>&eacute;</tt> produces the <tt>é</tt> character, while <tt>&Eacute;</tt> results in <tt>É</tt>. |
So, that's entities in a nutshell. Keep in mind that not all entities are recognized by older browsers. You may want to bookmark our [[Reference:Special Characters | ISO entities]] page for future reference. | So, that's entities in a nutshell. Keep in mind that not all entities are recognized by older browsers. You may want to bookmark our [[Reference:Special Characters | ISO entities]] page for future reference. | ||
<span id="title_name_el" class="wm_hidden_meta_class" title="Symbols, Accents, and Funky Characters " style="visibility:hidden"> <span id="page_path_el" class="wm_hidden_meta_class" title="/webmonkey/97/36/" style="visibility:hidden"> <span id="author_el" class="wm_hidden_meta_class" title="joanne" style="visibility:hidden"> <span id="creation_date_el" class="wm_hidden_meta_class" title="1997-09-11T24:00:00Z" style="visibility:hidden"> </span></span></span></span> | <span id="title_name_el" class="wm_hidden_meta_class" title="Symbols, Accents, and Funky Characters " style="visibility:hidden"> <span id="page_path_el" class="wm_hidden_meta_class" title="/webmonkey/97/36/" style="visibility:hidden"> <span id="author_el" class="wm_hidden_meta_class" title="joanne" style="visibility:hidden"> <span id="creation_date_el" class="wm_hidden_meta_class" title="1997-09-11T24:00:00Z" style="visibility:hidden"> </span></span></span></span> | ||
| + | == Introduction == | ||
| + | |||
| + | == What you'll need == | ||
| + | |||
| + | |||
| + | == Steps == | ||
| + | |||
| + | |||
| + | == Alternate methods == | ||
| + | |||
| + | |||
| + | == Suggested readings == | ||
Revision as of 23:41, 9 May 2008
When you type regular letters, numbers, and characters from your keyboard into the body of an HTML document, they show up on your Web pages just as you typed them. But things aren't so easy in non-English speaking countries (and such places do exist - honest). Languages such as French, German, and Icelandic often use characters that are not found on your typical keyboard. Even in English, accents can distinguish a "résumé" from a "resume."
So how do you make special characters and accented letters show up on your pages? You use a special set of codes called character entities, which you insert into your HTML code and which your browser will display as the corresponding symbols or characters you want.
The most common character entities have been collected by the International Organization for Standardization and compiled in the [[Reference: | Special Characters]] ISO Latin Alphabet No. 1 table, which includes special characters, letters with diacritical marks (accents, umlauts, etc.), and scientific and currency symbols. The Latin-1 table contains 255 characters.
There are two kinds of entities here:text and numeric. Both kinds begin with an ampersand ( &) and end with a semicolon ( ;).
The text entities use letters to represent a character, and they're designed to be easy to remember. So say you wanted to have the following sentence appear on your Web page:
"The © symbol stands for 'copyright.'"
Your HTML code would look like this:
"The © symbol stands for 'copyright.'"
Numeric entities are similar to text ones, but should be written in this form:&#x; - where the "x" represents a number between 0 and 255. It is very important to make sure that the # symbol precedes the number, or the entity will not work. So to make "The ��� symbol stands for 'copyright.'" with a numeric entity, your HTML would look like this:
"The © symbol stands for 'copyright.'"
As you can see, some characters (like ©) can be represented by either a text or a numeric entity.
A note of caution here:Many computers let you use keyboard shortcuts to create accented letters and special characters (for example, typing option + e will produce "é"). Beware, the shortcuts may not always work. The browser may read the character you created differently or not at all. This occurs because the code that is used to represent the character on the keyboard does not directly translate into Latin-1 and probably won't be read by your Web browser.
Sometimes, case can also be important. For example, é produces the é character, while É results in É.
So, that's entities in a nutshell. Keep in mind that not all entities are recognized by older browsers. You may want to bookmark our ISO entities page for future reference.
Contents |
Introduction
What you'll need
Steps
Alternate methods
Suggested readings
/related_articles/
Special Offer For Webmonkey Users
WIRED magazine:
The first word on how technology is changing our world.
