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

[FEATURE REQUEST] input_line, input_char, etc externals don't translate CRLF on Windows #1274

Open
phated opened this issue May 16, 2022 · 2 comments

Comments

@phated
Copy link
Contributor

phated commented May 16, 2022

Describe the bug
If an input channel is in text mode, it is supposed to convert CRLF line endings to LF on Windows. I didn't test the output channels, but they are supposed to convert LF to CRLF on Windows (not sure if that is implemented).

If I read a line using input_line(), the string ends with \r on Windows.

Expected behavior
I expect the translation to happen as documented in the OCaml docs. I believe this would only be the case for Nodejs backend.

Versions
OCaml 4.12, js_of_ocaml 3.11.0 (but I checked the code and it hasn't been fixed with v4).

@phated phated added the bug label May 16, 2022
@phated
Copy link
Contributor Author

phated commented May 16, 2022

I looked into fixing this, but I think it'll take a lot of changes to the MlNodeFile implementation (read, read_one, etc).

@hhugo
Copy link
Member

hhugo commented Jul 7, 2022

There doesn't seem to be any support for automatic CRLF translation in nodejs.
The behavior can be emulated in mlNodeFd easily I think. Feel free to give it a go.
It should be easier now that stdin/stout are no longer special

@hhugo hhugo added enhancement and removed bug labels Jul 11, 2022
@hhugo hhugo changed the title [BUG] input_line, input_char, etc externals don't translate CRLF on Windows [FEATURE REQUEST] input_line, input_char, etc externals don't translate CRLF on Windows Jul 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants