# HG changeset patch # User osimons # Date 1287521713 0 # Node ID f320205ca1f94aecf26ab018c2d1f6bba7250453 # Parent c837eaf8ff2ecf50edbeaf17e1157ed07a8be994 Ensure that master only sends utf-8 bodies (especially errors are prone to contain strings of unknown origin, potentially unicode). diff --git a/bitten/master.py b/bitten/master.py --- 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))