Skip to content
Permalink
Browse files

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

Resolves #1966.
  • Loading branch information
da2x committed Aug 23, 2015
1 parent c69770f commit a955f960c1aa0d13d7cfb0b025cd82085dc17717
Showing with 9 additions and 1 deletion.
  1. +5 −0 CHANGES.txt
  2. +4 −1 nikola/plugins/command/serve.py
@@ -7,6 +7,11 @@ Features
* New ``TAG_PAGES_TITLES`` and ``CATEGORY_PAGES_TITLES`` options
(Issue #1962)

Bugixes
-------

* Set UTF-8 charset in Content-Type or text/* and *+xml (Issue #1966)

New in v7.6.4
=============

@@ -242,7 +242,10 @@ def send_head(self):
f.seek(0)

self.send_response(200)
self.send_header("Content-type", ctype)
if ctype.startswith('text/') or ctype.endswith('+xml'):
self.send_header("Content-Type", "{0}; charset=UTF-8".format(ctype))
else:
self.send_header("Content-Type", ctype)
if os.path.splitext(path)[1] == '.svgz':
# Special handling for svgz to make it work nice with browsers.
self.send_header("Content-Encoding", 'gzip')

0 comments on commit a955f96

Please sign in to comment.
You can’t perform that action at this time.