diff --git a/pycsw/ogc/api/records.py b/pycsw/ogc/api/records.py index e69f7c5e3..bbdfd25a3 100644 --- a/pycsw/ogc/api/records.py +++ b/pycsw/ogc/api/records.py @@ -188,7 +188,7 @@ def get_response(self, status, headers, data, template=None): pretty_print = str2bool(self.config['server'].get('pretty_print', False)) content = to_json(data, pretty_print) - headers['Content-Length'] = len(content) + headers['Content-Length'] = len(content.encode('utf-8')) return headers, status, content diff --git a/pycsw/wsgi.py b/pycsw/wsgi.py index 293a528c6..37c2f921c 100644 --- a/pycsw/wsgi.py +++ b/pycsw/wsgi.py @@ -83,7 +83,7 @@ def application_dispatcher(env): csw = server.Csw(configuration_path, env) status, contents = csw.dispatch_wsgi() headers = { - 'Content-Length': str(len(contents)), + 'Content-Length': str(len(contents.encode("utf-8"))), 'Content-Type': str(csw.contenttype) } if "gzip" in env.get("HTTP_ACCEPT_ENCODING", ""):