Permalink
Browse files

Set UTF-8 charset in Content-Type in the `auto` command

Further resolves #1966.
  • Loading branch information...
da2x committed Aug 23, 2015
1 parent a955f96 commit 3ae5d5ec692d8de686804c395a3111bd04500573
Showing with 5 additions and 2 deletions.
  1. +5 −2 nikola/plugins/command/auto/__init__.py
@@ -300,11 +300,14 @@ def serve_static(self, environ, start_response):
mimetype = 'text/html'
if p_uri.path == '/robots.txt':
start_response('200 OK', [('Content-type', 'text/plain')])
start_response('200 OK', [('Content-type', 'text/plain; charset=UTF-8')])
return ['User-Agent: *\nDisallow: /\n'.encode('utf-8')]
elif os.path.isfile(f_path):
with open(f_path, 'rb') as fd:
start_response('200 OK', [('Content-type', mimetype)])
if mimetype.startswith('text/') or mimetype.endswith('+xml'):
start_response('200 OK', [('Content-type', "{0}; charset=UTF-8".format(mimetype))])
else:
start_response('200 OK', [('Content-type', mimetype)])
return [self.file_filter(mimetype, fd.read())]
elif p_uri.path == '/livereload.js':
with open(LRJS_PATH, 'rb') as fd:

0 comments on commit 3ae5d5e

Please sign in to comment.