Skip to content

tds: fix binary and char column values displaying as Python bytes repr#2214

Open
n3rada wants to merge 2 commits into
fortra:masterfrom
n3rada:fix/binary-display-mssql
Open

tds: fix binary and char column values displaying as Python bytes repr#2214
n3rada wants to merge 2 commits into
fortra:masterfrom
n3rada:fix/binary-display-mssql

Conversation

@n3rada

@n3rada n3rada commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

parseRow() stored raw bytes for three column types, causing values to render with the b'...' Python representation in SQL output (see #2043).

  • TDS_BIGVARBINTYPE / TDS_BIGBINARYTYPE: binascii.b2a_hex() returns bytes; added .decode("ascii") so the hex string prints cleanly.
  • TDS_IMAGETYPE: same issue, same fix.
  • TDS_BIGCHARTYPE / TDS_TEXTTYPE: raw byte slices stored without decoding; now decoded as latin-1 (with utf-8 fallback), matching how TDS_BIGVARCHRTYPE already handles character data.

Verified against a live SQL Server instance with enum_users (sp_helpuser), which exercises both TDS_BIGCHARTYPE (UserID) and TDS_BIGVARBINTYPE (SID).

@anadrianmanrique anadrianmanrique added the in review This issue or pull request is being analyzed label Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in review This issue or pull request is being analyzed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants