Skip to content

fix(read): fallback to raw bytes for non-UTF-8 reads - #1019

Closed
em0t wants to merge 1 commit into
rtk-ai:developfrom
em0t:fix/read-binary-fallback
Closed

em0t wants to merge 1 commit into
rtk-ai:developfrom
em0t:fix/read-binary-fallback

Conversation

@em0t

@em0t em0t commented Apr 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • preserve plain raw-read semantics for non-UTF-8 files by falling back to raw byte passthrough instead of failing early in rtk read
  • keep the fallback narrow: it only applies to unfiltered reads with no line windows and no line numbers
  • leave text-oriented modes unchanged, so filtered reads and -n still require valid UTF-8
  • add regression coverage for the binary fallback gate and the non-UTF-8 decode path

Minimal Cases

non-UTF-8 raw read

Raw

/bin/cat nonutf8.bin >/dev/null
exit 0

Previous RTK

rtk read nonutf8.bin >/dev/null
stderr contains: stream did not contain valid UTF-8
exit 1

This PR

rtk read nonutf8.bin >/dev/null
exit 0

Testing

  • cargo fmt --all
  • cargo test test_supports_binary_passthrough
  • cargo test test_binary_passthrough
  • cargo test --all

@pszymkowiak

Copy link
Copy Markdown
Collaborator

Thanks @em0t — the non-UTF-8 read bug is real and still present on develop. This branch is ~6 weeks behind though (329 commits, never rebased). Could you rebase onto develop first? Once it's up to date I'll do a full review on the current code — no point reviewing line-by-line against a 6-week-old base.

@em0t
em0t force-pushed the fix/read-binary-fallback branch from decad81 to 8e2b9eb Compare May 24, 2026 08:09
@em0t

em0t commented May 24, 2026 •

Copy link
Copy Markdown
Contributor Author

@pszymkowiak Thanks for taking a look.

I have rebased this branch onto current develop. Could you please continue the review when convenient?

@em0t

em0t commented Jun 3, 2026

Copy link
Copy Markdown
Contributor Author

@aeppling Sorry to bother you here.

This PR has also been rebased onto current develop after the previous review feedback, and it is now mergeable. @pszymkowiak had asked for the rebase before doing the full review.

Since you previously helped review and merge my RTK filter fixes, could you please take a look when you have time, or help route this to the right maintainer?

Thanks again.

@rtk-release-bot

Copy link
Copy Markdown
Contributor

This pull request has been automatically marked as stale due to 90 days of inactivity. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. Your contribution is very much appreciated — we're sorry we haven't been able to review it yet.

@rtk-release-bot rtk-release-bot Bot added the stale label Sep 3, 2026
@rtk-release-bot

Copy link
Copy Markdown
Contributor

Closing this pull request after a prolonged period of inactivity. If this is still relevant, please ask for it to be reopened. Thank you!

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants