Mercurial > bitten > bitten-test
diff bitten/master.py @ 872:f320205ca1f9
Ensure that master only sends utf-8 bodies (especially errors are prone to contain strings of unknown origin, potentially unicode).
author | osimons |
---|---|
date | Tue, 19 Oct 2010 20:55:13 +0000 |
parents | 59acaa8b52c0 |
children |
line wrap: on
line diff
--- a/bitten/master.py +++ b/bitten/master.py @@ -143,6 +143,8 @@ def _send_response(self, req, code=200, body='', headers=None): """ Formats and sends the response, raising ``RequestDone``. """ + if isinstance(body, unicode): + body = body.encode('utf-8') req.send_response(code) headers = headers or {} headers.setdefault('Content-Length', len(body))