CharSet Definition for Static HTML Files

I just tried several times to determine the character set for static files served by the Google App Engine, and failed.

The file contains the correct meta-equiv tag in the header section of the file:

<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> 

But it is not transmitted as a title, the browser needs to pick it up from the actual document.

Naturally, if I use a script (or the Python program for the Google App Engine), then I can get it correctly delivered as the response header.

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

I tried adding to the lines of the app.yaml file:

 - url: / static_files: root/create.html upload: root/create.html http_headers: Content-Type: text/html; charset=UTF-8 

But appcfg.py just tells me: Unexpected attribute "http_headers" for an object of type URLMap. in line "9oxnet / app.yaml", line 41, column 5

+4
source share
1 answer

To fix this character set header problem for static files, you need to define charset in the app.yaml file:

  - url: / static_files: root/create.html upload: root/create.html mime_type: text/html; charset=UTF-8 

Now the Content-Type header for static files also correctly contains character set information.

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

Some browsers do not analyze pages as quickly as possible unless encoding information is included in the headings.

+7
source

All Articles