Re: Content type is wrong

magick wrote:
> I am using the XHTML 1.1 doctype and this is is what I have as my 
> content type
> 
> <meta http-equiv="content-type" content="application/xhtml+xml; 
> charset=iso-8859-1" />

For real XHTML, that meta element is completely useless.  For HTML 
(including XHTML served wrongly as text/html), it's an inferior 
substitute for read HTTP headers and it will only ever set the character 
encoding when you've failed to do so properly.

The MIME type needs to be known *before* parsing can begin, and that 
meta element will not be seen until afterwards.  Also, the real HTTP 
headers always take precedence.

You can use this tool to see the HTTP headers sent by your server:
http://cgi.w3.org/cgi-bin/headers

If you're using Apache, it's a trivial exercise to configure your server 
to send the proper Content-Type header including both the MIME type and 
the character encoding information.  Look up .htaccess files and the 
AddType, AddCharset and AddDefaultCharset directives in the Apache 
documentation.  (Google will find them for you).

If you're using PHP, ASP, JSP or some other server side scripting 
language, you can use something like PHP's header() function, JSP's 
@page directive or whatever ASP uses.  (Look up the documentation for 
whatever you're using).

-- 
Lachlan Hunt
http://lachy.id.au/

Received on Friday, 23 December 2005 00:16:50 UTC