Supported by :   My Law Forms Ltd. - Deed polls and Tenancy Agreements

Internet Media Type – Specify Character Encoding

When creating an XHTML document you will need to specify the character encoding Internet Media Type, or Content-Type of the document. The W3C recommends that XHTML documents be sent as type text/html or application/xhtml+xml. This should be set by the webserver. If you cannot change the web server settings however, you can also specify this in your document. You specify the character encoding by using a meta tag with the http-equiv attribute set to “Content-Type”, and the content attribute set to one of the above values. Here’s how it looks:
<meta http-equiv= “Content-Type” content=“text/html; charset=UTF-8” />

So what’s this “charset” business? It’s the character encoding for the document—essentially what characters your page will support. This is important to make sure that all the characters on your page will be displayed properly when people access your page. Some of the most common character encodings are UTF-8, ISO-8855-1, and ISO-8859-5.
If you choose to use the application/xhtml+xml Internet Media Type, which is recommended by the W3C, you will also need to specify the character encoding in an XML declaration. This declaration should be the first line in your document, even before the DOCTYPE.

<?xml version=”1.0″ encoding=”UTF-8″?>

Technorati Profile

This entry was posted on Thursday, March 8th, 2007 at 10:18 am and is filed under HTML help, XHTML tips. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Comments are closed.