From 638fbcb619d8a316c4d4c9440999c886d7e5b9ab Mon Sep 17 00:00:00 2001 From: Channel Cat Date: Mon, 16 Jan 2017 17:03:55 -0800 Subject: [PATCH] Encoding needs a default --- sanic/response.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sanic/response.py b/sanic/response.py index 9ec2d91a..ba10b8c4 100644 --- a/sanic/response.py +++ b/sanic/response.py @@ -106,11 +106,11 @@ class HTTPResponse: for name, value in self.headers.items(): try: headers += ( - b'%b: %b\r\n' % (name.encode(), value.encode())) + b'%b: %b\r\n' % (name.encode(), value.encode('utf-8'))) except AttributeError: headers += ( b'%b: %b\r\n' % ( - str(name).encode(), str(value).encode())) + str(name).encode(), str(value).encode('utf-8'))) # Try to pull from the common codes first # Speeds up response rate 6% over pulling from all