Open lionel-rowe opened 1 year ago
This stems from Deno reading directly from console input as a file, which uses the console's current code page rather than Unicode (see High-Level Console I/O). In the example, 'ÿ' maps to 152 in code page 437 (OEM-US).
Instead ReadConsoleW
should be used, as in Rust's std::io::Stdin
.
@dsherret Is there a reason Deno doesn't use Rust/Tokio's stdio implementation? If not, would a PR be welcome?
Yes, a PR would be welcome. I believe it should use std::io::stdin
here when StdFileResourceKind::Stdin
:
Similar to how it does this for write:
Hey, I just stumbled across this issue having the same problem. Characters like ÄÖÜ
(non ASCII) are corrupted. Any update on when this gets fixed?
Thanks
stdin.read
(andstdin.readSync
) corrupt non-ASCII input on Windows.To reproduce:
Then, enter a non-ASCII character. The resulting bytes will be corrupted on Windows.
Examples, with trailing LF/CRLF/null bytes truncated:
[195, 191]
[152]
[196, 128]
[65]
[196, 129]
[97]
[229, 149, 138]
[63]
[240, 159, 166, 132]
[63, 63]
Expected results are the UTF-8 bytes. Results on Linux are as expected.