Consistently return charset utf-8, closes #752

This commit is contained in:
Simon Willison 2020-05-04 10:41:58 -07:00
commit 9424687e9e
4 changed files with 19 additions and 9 deletions

View file

@ -828,7 +828,7 @@ class DatasetteRouter(AsgiRouter):
view_name="page",
)
# Pull content-type out into separate parameter
content_type = "text/html"
content_type = "text/html; charset=utf-8"
matches = [k for k in headers if k.lower() == "content-type"]
if matches:
content_type = headers[matches[0]]