From 7469daa6d1f7911a57bc00cbd0836bdc4c8a289a Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Mon, 17 Oct 2016 16:10:41 -0600 Subject: [PATCH] Fix character set issues on Windows --- devel-server.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/devel-server.py b/devel-server.py index 410e109..6ec4e74 100755 --- a/devel-server.py +++ b/devel-server.py @@ -93,7 +93,7 @@ you are a fool. body.append("* [puzzles/{cat}/{points}](/puzzles/{cat}/{points}/)".format(cat=parts[2], points=puzzle)) elif len(parts) == 4: body.append("# {} puzzle {}".format(parts[2], parts[3])) - with open("puzzles/{}/{}.moth".format(parts[2], parts[3])) as f: + with open("puzzles/{}/{}.moth".format(parts[2], parts[3]), encoding="utf-8") as f: p = puzzles.Puzzle(f) body.append("* Author: `{}`".format(p.fields.get("author"))) body.append("* Summary: `{}`".format(p.fields.get("summary"))) @@ -126,7 +126,7 @@ you are a fool. content = mdpage(text) self.send_response(http.server.HTTPStatus.OK) - self.send_header("Content-type", "text/html; encoding=utf-8") + self.send_header("Content-type", "text/html; charset=utf-8") self.send_header("Content-Length", len(content)) try: fs = fspath.stat()