Google app engine 为静态HTML文件定义字符集
我只是尝试了好几次为Google App Engine提供的静态文件定义字符集,但都失败了 文件的标题部分不包含正确的meta equiv标记:Google app engine 为静态HTML文件定义字符集,google-app-engine,http-headers,content-type,static-files,app.yaml,Google App Engine,Http Headers,Content Type,Static Files,App.yaml,我只是尝试了好几次为Google App Engine提供的静态文件定义字符集,但都失败了 文件的标题部分不包含正确的meta equiv标记: <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> 我试图添加到app.yaml文件行: - url: / static_files: root/create.html upload: root/create.html http_header
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
我试图添加到app.yaml文件行:
- url: /
static_files: root/create.html
upload: root/create.html
http_headers:
Content-Type: text/html; charset=UTF-8
但是appcfg.py只是告诉我:
URLMap类型的对象的意外属性“http\U头”。
在“9oxnet/app.yaml”第41行第5列中,要解决静态文件的此字符集标题问题,您需要在app.yaml文件中定义字符集:
- url: /
static_files: root/create.html
upload: root/create.html
mime_type: text/html; charset=UTF-8
现在,静态文件的内容类型头也正确地包含字符集信息
Content-Type: text/html; charset=UTF-8
如果标题中不包含字符集信息,则某些浏览器不会尽快解析页面
Content-Type: text/html; charset=UTF-8