您可以在Google AMP项目中使用charset =“ISO-8859-1”

时间:2016-10-06 13:41:05

标签: html

我将展示我的问题:

这是有效的:

<!doctype html>
<html amp lang="en">
  <head>
    <meta charset="utf-8">
    <script async src="https://cdn.ampproject.org/v0.js"></script>
    <title>mytitle</title>
    <link rel="canonical" href="http://www.djflkjslkfjsdlkfjsldkjfklsd.com/" />
    <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet">
    <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
    <script type="application/ld+json">
      {
        "@context": "http://schema.org",
        "@type": "NewsArticle",
        "headline": "Open-source framework for publishing content",
        "datePublished": "2015-10-07T12:02:41Z",
        "image": [
          "logo.jpg"
        ]
      }
    </script>
    <style  amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style>
    <noscript>
    <style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none} 

    </style>

    </noscript>

  </head>
  <body>

  </body>
</html>

我可以在#development=1

上验证它

但是,如果我更改了<meta charset="utf-8">

<meta charset="ISO-8859-1">

停止工作:

The attribute 'charset' may not appear in tag 'meta name= and content='.
The mandatory tag 'meta charset=utf-8' is missing or incorrect. (see https://www.ampproject.org/docs/reference/spec.html#required-markup)

阅读文档here。我怀疑这个字符集。 utf-8是唯一真正有效的吗?

1 个答案:

答案 0 :(得分:3)

  

utf-8是唯一真正有效的吗?

是。 AMP需要UTF-8。

本世纪没有理由将ISO-8859用于新的发展。