Skip to content

Commit 8d0245d

Browse files
committed
Improve how we decode strings
1 parent 090acab commit 8d0245d

File tree

1 file changed

+4
-3
lines changed
  • debug_toolbar/utils/tracking

1 file changed

+4
-3
lines changed

debug_toolbar/utils/tracking/db.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,10 @@ def _quote_params(self, params):
9292
return map(self._quote_expr, params)
9393

9494
def _decode(self, param):
95-
if isinstance(param, unicode):
96-
return param.decode('utf-8', 'ignore')
97-
return param
95+
try:
96+
return force_unicode(param, strings_only=True)
97+
except UnicodeDecodeError:
98+
return '(encoded string)'
9899

99100
def execute(self, sql, params=()):
100101
start = datetime.now()

0 commit comments

Comments
 (0)