网页编码,设置相互矛盾 [英] web page encoding, with contradictory settings

查看:119
本文介绍了网页编码,设置相互矛盾的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果网页有,

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
…
</head>

但http标头有

Content-Type    text/html; charset=UTF-8

那么假定编码是什么?

推荐答案

在HTML5中,优先级定义为:

In HTML5 the priority is defined as:


  1. 用户浏览器设置

  2. 字节顺序标记

  3. HTTP标头

  4. < meta http-equiv =内容类型> < meta charset> ,具体取决于属性顺序。

  5. 浏览器默认值对于语言环境。

  1. User browser setting
  2. Byte order mark
  3. HTTP header
  4. <meta http-equiv="Content-Type"> or <meta charset> depending on attribute order.
  5. Browser default for the locale.

参见 http://www.w3.org/html/wg/drafts/html/master/syntax.html#determining-the-character对于血淋淋的细节进行编码

这篇关于网页编码,设置相互矛盾的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆