XML has two MIME types, application/xml and text/xml. These are often used interchangeably, but there is a subtle difference which is why application/xml is generally recommended over the latter.
Let me explain why: according to the standard, text/*-MIME types have a us-ascii character set unless otherwise specified in the HTTP headers. This effectively means that any encoding defined in the XML prolog (e.g. ) is ignored. This is of course not the expected and desired behavior.
“application/xml is generally the preferred mime type. For text/xml it appears the encoding will generally be treated as us ascii regardless of what is specified in the XML document header (unless otherwise specified in the HTTP headers).”
网友评论