Skip to content

fix(sqlite): display UTF-8 BLOB values as text - #696

Merged
debba merged 1 commit into
mainfrom
fix/sqlite-text-blob-display
Aug 31, 2026
Merged

debba merged 1 commit into
mainfrom
fix/sqlite-text-blob-display

Conversation

@debba

@debba debba commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • display complete generic BLOB values as text when they contain printable UTF-8
  • keep hexadecimal previews for invalid UTF-8 and binary control characters
  • add coverage for Unicode file paths and binary fallback behavior

Testing

  • pnpm test tests/utils/blob.test.ts tests/utils/dataGrid.test.ts tests/utils/clipboard.test.ts
  • pnpm exec eslint src/utils/blob.ts
  • pnpm exec tsc --noEmit

Fixes #695

@kilo-code-bot

kilo-code-bot Bot commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

The PR adds formatBlobTextPreview to display complete generic (application/octet-stream) BLOB values as UTF-8 text when they are printable, falling back to the existing hex/metadata previews otherwise. The implementation mirrors the established formatBlobHexPreview guard pattern, uses a fatal TextDecoder (with try/catch fallback) to reject invalid UTF-8, and applies a reasonable binary-control-character heuristic (allowing only TAB/LF/CR). metadata is verified non-null before use, so no NPE risk. The new tests cover a multibyte UTF-8 path, invalid UTF-8 (hex fallback), and a NUL-containing value (hex fallback).

Files Reviewed (2 files)
  • src/utils/blob.ts
  • tests/utils/blob.test.ts

Reviewed by glm-5.2 · Input: 32.7K · Output: 6.9K · Cached: 117.4K

@debba
debba merged commit 6c01c99 into main Aug 31, 2026
2 checks passed
@agross agross mentioned this pull request Aug 31, 2026
2 tasks done
@debba
debba deleted the fix/sqlite-text-blob-display branch October 17, 2026 07:34
NewtTheWolf pushed a commit that referenced this pull request Nov 9, 2026
A BLOB the grid shows as text (complete, generic, printable UTF-8 since
#696) still opened the row editor on hex. Open it in a Text editor with a
Text/Hex switch, and save the text as UTF-8 in the same BLOB wire format
the hex editor writes, keeping the MIME type.

Text editing is only offered when saving the text unchanged writes back
the same bytes, so CRLF text and a UTF-8 byte order mark stay in hex.

Closes #698
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: SQlite Blob columns displayed as hexdump

1 participant