Skip to content

Commit c1b6157

Browse files
authored
fixes #1091 (#1092)
encode content before counting
1 parent ef2c511 commit c1b6157

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

pycsw/ogc/api/records.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def get_response(self, status, headers, data, template=None):
188188
pretty_print = str2bool(self.config['server'].get('pretty_print', False))
189189
content = to_json(data, pretty_print)
190190

191-
headers['Content-Length'] = len(content)
191+
headers['Content-Length'] = len(content.encode('utf-8'))
192192

193193
return headers, status, content
194194

pycsw/wsgi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def application_dispatcher(env):
8383
csw = server.Csw(configuration_path, env)
8484
status, contents = csw.dispatch_wsgi()
8585
headers = {
86-
'Content-Length': str(len(contents)),
86+
'Content-Length': str(len(contents.encode("utf-8"))),
8787
'Content-Type': str(csw.contenttype)
8888
}
8989
if "gzip" in env.get("HTTP_ACCEPT_ENCODING", ""):

0 commit comments

Comments
 (0)