Web Idea Center
Search    

What's New | IT Help Center | UD Home | Comment  
Home How to Images and Templates Read More Get Help

book Read More
    HTML REFERENCES > CHARACTER ENCODING

CHARACTER ENCODING

The contents of this page are an excerpt from Liam Quinn's htmlhelp.com. Click on the link to learn more.

To ensure W3C compliance and allow your web pages to be properly validated, you must have the following code placed at the top of each one of your web pages:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

This tells the validator that your are using HTML 4.0 compliant code.

In the HEAD section of your page, place the following code:

<META-HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">

This tells the validator that you are using standard western european or latin-1 characters in your web pages. Inserting this code will ensure proper validation for your web pages.

A character encoding is a method of converting bytes into characters. To validate or display an HTML document, a program must choose a character encoding. For documents in English and most other Western European languages, the widely supported encoding ISO-8859-1 is typically used.

Versions of HTML prior to HTML 4.0 supported a limited character set, only allowing those characters that could be encoded using ISO-8859-1. Documents that use Chinese, Cyrillic, Greek, or other non-Latin characters must therefore use HTML 4.0 (or a custom version of HTML). Attempting to validate non-Latin documents against HTML 3.2 or earlier versions will result in an error for each non-Latin character.

An HTML document must specify its character encoding. The preferred method of indicating the encoding is by using the charset parameter of the Content-Type HTTP header. For example, to specify that an HTML document uses ISO-8859-1, you would use the following tag in the HEAD of an HTML document:

<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

This method requires that ASCII characters stand for themselves until after the <META> tag and often causes an annoying redraw with Netscape. The META HTTP-EQUIV method should only be used if one cannot set the charset parameter using the server.


MORE INFORMATION

Validate by URL ~ Validate by file upload ~ Validate by direct input

HTML 4.0 Reference ~ HTML 3.2 Reference ~ Tools ~ Other Validators


University of Delaware