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

TextDecoder doesn't implement "stream" option #5542

Open
milkmuffin opened this issue Sep 16, 2023 · 1 comment
Open

TextDecoder doesn't implement "stream" option #5542

milkmuffin opened this issue Sep 16, 2023 · 1 comment
Labels
bug Something isn't working web:encoding

Comments

@milkmuffin
Copy link

What version of Bun is running?

1.0.2

What platform is your computer?

Linux 5.15.90.1-microsoft-standard-WSL2 x86_64 unknown

What steps can reproduce the bug?

const decoder = new TextDecoder('utf-8');
const first = decoder.decode(new Uint8Array([226, 153]), { stream: true });
const second = decoder.decode(new Uint8Array([165]), { stream: true });
console.log({first, second});

What is the expected behavior?

first should be an empty string and second should return a string

What do you see instead?

Both first and second are populated with incorrect values

Additional information

No response

@milkmuffin milkmuffin added the bug Something isn't working label Sep 16, 2023
@Electroid Electroid added the web-api Something that relates to a standard Web API label Sep 16, 2023
@rexxars
Copy link

rexxars commented Apr 27, 2024

Was hoping that I could use the stream option as an alternative to the missing TextDecoderStream API, but ran into this same bug.

I'd actually prefer if bun threw an error when passing stream: true, since it can lead to quite subtle bugs.

@Electroid Electroid added web:encoding and removed web-api Something that relates to a standard Web API labels Jun 12, 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 web:encoding
Projects
None yet
Development

No branches or pull requests

3 participants