I saved an XHTML document as a text file so that I could display the source code for users to download. I have Apache HTTPD set up to leave off extensions with MultiViews. So while there is only one resource, xhtml.txt, but it is accessible via /xhtml as well as /xhtml.txt. In either case, the response headers report "Content-Type:text/plain; charset=utf-8". And yet, if I request /xhtml, WebKit renders the document incorrectly, parsing it as if it were actual XHTML. If I request it with .txt on the end of it, it renders the document correctly as plain text. However, if I remove the XML prolog, it is rendered as plain text in both instances. Gecko and Presto both display plain text regardless of whether an XML prolog is present.
The draft specification governing content type sniffing is at <http://tools.ietf.org/html/draft-abarth-mime-sniff>. I don't know whether Safari works in accordance with it here.
The draft prevent sniffing of XML from text/plain. Safari does sniff from text/plain in some cases.
The same document may still get sniffed as HTML. I guess we need to have the original document to find out what exactly happened. Reporter, would it be possible for you to upload it?
Created attachment 71322 [details] XHTML as Plain Text
Thanks! Yes, that's sniffed as <application/xhtml+xml>. Adam, what does the spec say? Should it be text/plain, or text/html?
> Adam, what does the spec say? Should it be text/plain, or text/html? text/plain. We should never sniff HTML or XML from text/plain. The spec says text/plain can only become types that are not scriptable.