As you learned earlier in the week, H;TML files are ASCII text and should contain no for-matting or fancy characters. In fact, the only characters you should put in your HTML files are the characters that are actually prated on your keyboard, if you have to bold down any key other than shift, or type an arcane combination of keys to produce a single character, you can’t use that character in your HTML file. This includes characters you might use every day,. Such as Em dashes and curly quotes (if your word processor 8is set up to do automatic curly quotes, you should turn them of when you write your HTML files).
“but wait a minute”, you say, “if I can type a character like a bullet or an accented a on my keyboard using a special key sequence, and I can include it in an HTML file, and my browser can display it just fine when I look a that file, what’s the problem?”
The problem is that the internal encoding your computer does to produce that character (which enables it to show up properly in your HTML file and in your browser’s display’s probably won’t translate to other computers. someone on the internet who’s reading your plain garbage. Or, depending on how your page is sent over the internet, the character might be lost before it ever gets to the computer where the file is being viewed.
So, what can you do? HTML provides a reasonable solution, it defines a special set 9of a codes, called character entities, that you can include in your HTML files to represent the characters you want to use. When interpreted by a browser, these character entities are displayed as the appropriate special characters for the given platform and font.
Some special characters don’t come from the set of extended ASCII character set. These characters have a special meaning in HTML documents within certain contexts, so they can be represented with character entities in order to avoid confusing the web browsers. Modern browsers generally don’t have a problem with these characters, but it’s not a bad idea to use the entities anyway
.CHARACTER ENTITIES FOR SPECIAL CHARACTERS
Character entities take one of two forms: named entities and numbered entities:
Named entities begin with an ampersand (&) and end with a semicolon (;). In between is the name of the character (or, more likely, a shorthand version of that name, such as agave for an a with a grave accent, or reg for a registered trademark design). Unlike other HTML. Tags, the names are case sensitive, so you should make sure to type them in exactly. Named entities look something like the following:
& a grave;
& quota;
& 1aquo;
©
The numbered entities also begin with an ampersand and end with a semicolon, but rather than a name, they have a pound sign (#) and a number. The numbers correspond to character positions in the ISO- latin-1(ISO 8859-1) character. Every character you can type or for which you can use a named entity also has a numbered entity. Numbered entities look like the following:
‚
õ
You can use either numbers or named entities in your HTML file by including them in the same place that the character they represent would go. So, to place the word resume in your HTML file, your would use either.
R& acuter ; sum é ;
Or
R&233; sumé
In appendix b, “HTML 4.01 quick reference, “ I’ve included a table that lists the named entities currently supported by HTML. See that table for specific characters.
No comments:
Post a Comment