meta标签应该是utf-8还是不重要?

时间:2009-11-22 13:17:28

标签: php html meta-tags

我应该用utf-8格式编写元标记吗?

例如,可以在元关键字中使用双引号:

 19" wheels

或&等特殊字符签署......?

由于

注意:我在所有页面上使用utf-8编码!

2 个答案:

答案 0 :(得分:0)

字符集取决于您对整个页面进行编码的设置。

至于引号和其他特殊字符,您需要使用character references转义它们:

"

对于像国家这样真正特殊的人物,他们应该是o.k.只要页面使用适当的编码(即utf-8)就可以使用。

答案 1 :(得分:0)

  

我应该用utf-8格式编写元标记吗?

您应该始终使用一致的编码。

  

例如,在元关键字

中使用双引号是否可以

与所有属性值一样,您不能使用在值中分隔属性值的字符,而不使用实体表示它。

<meta name="length" content="19""> <!-- This is an error -->
<meta name="length" content='19"'> <!-- This is fine -->
<meta name="length" content='19&quot;'> <!-- This is fine -->
<meta name="length" content="19&quot;"> <!-- This is fine -->
<meta name="length" content="19″"> <!-- Using the double prime character is also fine.
                                        It is distinct from the double quotes used to 
                                        delimit the attribute value.
                                        Technically, it is the best option as it is the
                                        correct character to represent an inch.
                                     -->
  

或&amp;等特殊字符签署......?

有些时候你可以在HTML数据中使用原始的&符号,但它们很少见,而且总是使用&amp;更容易,那就是试着记住异常。