Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 3ae5d5e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions nikola/plugins/command/auto/__init__.py
Expand Up @@ -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:
Expand Down

0 comments on commit 3ae5d5e

Please sign in to comment.