首页 > 移动平台 > 详细

text/html 与 application/html的区别

时间:2020-04-09 15:46:25      阅读:253      评论:0      收藏:0      [点我收藏+]

简而言之:

text/html, 表示的是文件编码方式首先使用响应头content-type指定的编码方式来解码,如果请求头没有指定则使用ASCII。文件类型为html。

application/html,表示的是文件编码方式首先使用文件头指定的格式,其次使用响应头指定的方式,如果都没有则使用ASCII。文件类型为html。

 

详细解析:

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.

XML有两种媒体类型(MIME),application/xml 和 text/xml。虽然这两种类型非常相似经常可以互换使用,但它们之间依然后一个非常明显的区别。权威人士一般推荐使用 application/xml,以下展开说明以下它们之间的区别。


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. <?xml version=”1.0” encoding=”UTF-8”?>) is ignored. This is of course not the expected and desired behaviour.

在一次响应中,有两个地方可以指定响应内容的格式,一个是响应头的content-type字段,另一个是xml的序言部分(prolog,e.g. <?xml version="1.0", encoding="UTF-8"?>)。根据定义,如果是text/* 则在解析响应体内容时,首先会根据响应头指定的格式,如果响应头没有指定,则使用ascii,忽略xml序言中指定的格式。如果是application/* 则首先使用xml序言中指定的格式,而后使用响应头中指定的格式,如果都没有指定才使用ascii格式解析。

 

text/html 与 application/html的区别

原文:https://www.cnblogs.com/cbhe/p/12667230.html

(1)
(1)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!