0

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

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

 19" wheels

或特殊字符,如 & 符号...?

谢谢

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

4

2 回答 2

0

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

至于引号和其他特殊字符,您需要使用字符引用对其进行转义:

"

对于像国这样的特殊字符,只要页面使用适当的编码(即utf-8)就可以使用它们。

于 2009-11-22T13:19:59.430 回答
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.
                                     -->

或特殊字符,如 & 符号...?

有时您可以在 HTML 数据中使用原始 & 符号,但它们并不常见,而且总是更容易使用,&amp;然后尝试记住异常。

于 2010-04-16T19:04:52.423 回答