aboutsummaryrefslogtreecommitdiffstats
path: root/debug_toolbar/utils
diff options
context:
space:
mode:
authorDavid Cramer2013-02-20 13:44:10 -0800
committerDavid Cramer2013-02-20 13:44:42 -0800
commit8d0245d51bf3dda12a89dd1b5b5e5bad69959519 (patch)
treea7b49c84a76c5015f723e3d6fc0d60125a2dca22 /debug_toolbar/utils
parent090acab49e07a09c678a510a812a97724bdaf2a5 (diff)
downloaddjango-debug-toolbar-8d0245d51bf3dda12a89dd1b5b5e5bad69959519.tar.bz2
Improve how we decode strings
Diffstat (limited to 'debug_toolbar/utils')
-rw-r--r--debug_toolbar/utils/tracking/db.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/debug_toolbar/utils/tracking/db.py b/debug_toolbar/utils/tracking/db.py
index db9974e..b675227 100644
--- a/debug_toolbar/utils/tracking/db.py
+++ b/debug_toolbar/utils/tracking/db.py
@@ -92,9 +92,10 @@ class NormalCursorWrapper(object):
return map(self._quote_expr, params)
def _decode(self, param):
- if isinstance(param, unicode):
- return param.decode('utf-8', 'ignore')
- return param
+ try:
+ return force_unicode(param, strings_only=True)
+ except UnicodeDecodeError:
+ return '(encoded string)'
def execute(self, sql, params=()):
start = datetime.now()