Skip to content

Commit c2d372d

Browse files
committed
back
1 parent 40884d1 commit c2d372d

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

sentry_sdk/tracing_utils.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -354,13 +354,7 @@ def _format_sql(cursor, sql):
354354
if hasattr(cursor, "mogrify"):
355355
real_sql = cursor.mogrify(sql)
356356
if isinstance(real_sql, bytes):
357-
# Use UTF-8 as default, with latin1 fallback for edge cases
358-
bytes_sql = real_sql # make pypy happy (type narrowing to bytes)
359-
try:
360-
real_sql = bytes_sql.decode("utf-8")
361-
except UnicodeDecodeError:
362-
# If UTF-8 fails, try latin1 as fallback
363-
real_sql = bytes_sql.decode("latin1", errors="replace")
357+
real_sql = real_sql.decode(cursor.connection.encoding)
364358
except Exception:
365359
real_sql = None
366360

0 commit comments

Comments
 (0)