PDA

View Full Version : How to set the http-equiv="Content-Type" when writing XHTML documents.


3D_Dog_Man
05-19-2004, 01:57 AM
Hi Everybody,

I have written an xhtml document that looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/xml; charset=UTF-8" />
.....
.....

When I try to validate this at the W3C I get the following error message:

The HTTP Content-Type header sent by your web browser (unknown) did not contain a "charset" parameter, but the Content-Type was one of the XML text/* sub-types (text/xml). The relevant specification (RFC 3023) specifies a strong default of "us-ascii" for such documents so we will use this value regardless of any encoding you may have indicated elsewhere. If you would like to use a different encoding, you should arrange to have your browser send this new encoding information.

I am wondering how to go about giving the document correct meta information. I need this xhtml document to work in IE6+ and NS7+. If anybody knows how to make the xml declaration and meta data behave could you please let me know?

Thanks for your help.

Regards

David

Alex Vincent
05-19-2004, 11:22 PM
Web browser unknown? That's something I've never seen before.

As far as I can tell, your meta tag is correct. The error is being generated not by the tag.

The key is this sentence:

If you would like to use a different encoding, you should arrange to have your browser send this new encoding information.

Translation: this is not your fault.

(1) What browser are you using to validate the document?
(2) What operating system?

If it's a Mozilla-based browser, about: will give you a "build string" immediately below the large blue link telling you the alleged version number. This information is often very helpful.

M@rco
05-23-2004, 01:36 PM
The only sense I can make of the error message that you received it is that you pasted the XML document into a text box in a form which you then submitted to the validator. Is this correct?

If so, then it's nothing to worry about. I suggest that you upload the document instead, and get the validator to check the document via URL.