Skip to content

Additional fixes for UTF-8 surrogate escapes #629

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Aug 15, 2017
Merged
4 changes: 2 additions & 2 deletions elasticsearch/connection/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def log_request_success(self, method, full_url, path, body, status_code, respons
# body has already been serialized to utf-8, deserialize it for logging
# TODO: find a better way to avoid (de)encoding the body back and forth
if body:
body = body.decode('utf-8')
body = body.decode('utf-8', 'ignore')

logger.info(
'%s %s [status:%s request:%.3fs]', method, full_url,
Expand All @@ -100,7 +100,7 @@ def log_request_fail(self, method, full_url, path, body, duration, status_code=N
# body has already been serialized to utf-8, deserialize it for logging
# TODO: find a better way to avoid (de)encoding the body back and forth
if body:
body = body.decode('utf-8')
body = body.decode('utf-8', 'ignore')

logger.debug('> %s', body)

Expand Down