Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix handling of unbuffered byte streams that split UTF-8 char across read() calls #105

Merged
merged 2 commits into from
Jan 8, 2025

Conversation

smheidrich
Copy link
Owner

@smheidrich smheidrich commented Jan 8, 2025

daggaz/json-stream#59 ran into an issue with json-stream's feature allowing users to pass iterables of bytes to load, which makes it wrap them in a RawIOBase interface that pulls data from these iterables when read.

That exposed a more general bug in json-stream-rs-tokenizer when it comes to handling unbuffered byte streams that return UTF-8 chars split across multiple read() calls.

This PR adds a regression test for the specific case that brought this up and fixes it.

In the future, I should add lower-level tests to ensure that situations like this are handled correctly for all other kinds of streams as well, not just unbuffered bytes (#107, #108).

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.

1 participant