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

[Bug]: Consuming raw bytes with CLI return incorrect data #3967

Open
nacardin opened this issue Apr 24, 2024 · 1 comment
Open

[Bug]: Consuming raw bytes with CLI return incorrect data #3967

nacardin opened this issue Apr 24, 2024 · 1 comment
Labels
bug Something isn't working no-issue-activity no-stale Opt-out of closing issue due to no activity

Comments

@nacardin
Copy link
Contributor

Steps to reproduce:

  1. Create a file test.bin with the following bytes 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0xF0, 0x90, 0x80, 0x57, 0x6F, 0x72, 0x6C, 0x64. This is from https://doc.rust-lang.org/std/string/struct.String.html#method.from_utf8_lossy "Incorrect bytes" example
$ fluvio produce bin-test --raw -f test.bin
$ fluvio consume -B bin-test -O raw > test-output.bin

In the test-output.bin file, the bytes will be 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0xEF, 0xBF, 0xBD, 0x57, 0x6F, 0x72, 0x6C, 0x64, 0x0A. 0xF0, 0x90, 0x80 is replaced by 0xEF, 0xBF, 0xBD.

I believe this happens to the inappropriate use of from_utf8_lossy in

String::from_utf8_lossy(record).to_string()

This is binary data, it should not be parsed as utf8.

@nacardin nacardin added the bug Something isn't working label Apr 24, 2024
Copy link

Stale issue message

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 2, 2024
@digikata digikata added the no-stale Opt-out of closing issue due to no activity label Jul 2, 2024
@digikata digikata reopened this Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working no-issue-activity no-stale Opt-out of closing issue due to no activity
Projects
None yet
Development

No branches or pull requests

2 participants