Skip to content

Commit

Permalink
Fix unicode error when trying to escape binary data
Browse files Browse the repository at this point in the history
  • Loading branch information
dbowd committed Oct 18, 2018
1 parent a2ed32c commit 0bb6494
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion debug_toolbar/panels/sql/tracking.py
Expand Up @@ -84,7 +84,10 @@ def __init__(self, cursor, db, logger):

def _quote_expr(self, element):
if isinstance(element, six.string_types):
return "'%s'" % force_text(element).replace("'", "''")
try:
return "'%s'" % force_text(element).replace("'", "''")
except DjangoUnicodeDecodeError:
return repr(element)
else:
return repr(element)

Expand Down

0 comments on commit 0bb6494

Please sign in to comment.