-
Notifications
You must be signed in to change notification settings - Fork 30.5k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Invalid characters in stdout �� #52944
Comments
Hi! Can you give some example code to reproduce this? My initial assumption is that the encoding is mismatched between |
I tried just to read file and print its content and it works. But if I read from stdin, it makes script.mjs #!/usr/bin/env node
let text = '';
if (!process.isTTY) for await (const chunk of process.stdin) text += chunk;
process.stdout.write(text); ./script.mjs < latest_be_by.txt > be_tarask_by_2.txt |
What happens if you replace |
Nothing changed. I think the problem is with reading from stdin, not with writing. console.log(/��/.test(text));
// true |
It's possible it's reading in an incorrect encoding, I'm not quite sure, but I'll label this as |
Thank you, I found a right way to read from stdin and it works now |
Version
v21.7.3
Platform
WSL2, Manjaro Linux, also tried with git bash
Subsystem
No response
What steps will reproduce the bug?
process.stdout.write
large string of utf-8 charactersHow often does it reproduce? Is there a required condition?
No response
What is the expected behavior? Why is that the expected behavior?
not replacing characters with
��
What do you see instead?
��
Additional information
Cannot reproduce using
bun
.Related: GooseOb/taraskevizer#5, fsouza/prettierd#694
The text was updated successfully, but these errors were encountered: