On 2/11/07, Lachlan Hunt <[EMAIL PROTECTED]> wrote:

Pierre-Henri Lavigne wrote:
> Regards to http://www.w3.org/MarkUp/2004/xhtml-faq#ie I just discovered,
> I was just wondering if we could use :
>
> <?php
> if (stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml")) {

You need to check the q value.

e.g.  If a browser sends this:

Accept: text/html;application/xhtml+xml;q=0.5

text/html is preferred over application/xhtml+xml.

>    header("Content-Type: application/xhtml+xml; charset=UTF-8");

You don't need to include the charset parameter in this header for XML
MIME types (this does not apply to text/html).  XML is designed as a
self describing format and does not need the information to be there.
Although, it does little harm by including it.  There is, however, a
mostly theoretical issue of the document being transcoded by an
intermediate server, which wouldn't update the XML declaration.


Will you care to elaborate this? You're saying that since "xml is
self-describig" there is no need to include the encoding parameter in
content-type. This is not accurate. By including the content type, you are
letting the HTTP client know of the encoding to use to parse the body of the
HTTP response. The purpose of the encoding in the preamble in XML documents
is similar to meta tags used for encoding in HTML documents. In the absence
of the encoding parameter in the content type, the client has to parse the
preamble using some default/safe encoding, and then reparse the complete
response with the encoding found in the preamble. The encoding parameter in
the content type saves this trouble.

Subbu



--
------------------------------
http://www.subbu.org


*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
*******************************************************************

Reply via email to