Skip to content
This repository has been archived by the owner on Jun 13, 2018. It is now read-only.

Incorrect line terminator on Windows #135

Open
eclazi opened this issue Nov 18, 2016 · 2 comments
Open

Incorrect line terminator on Windows #135

eclazi opened this issue Nov 18, 2016 · 2 comments

Comments

@eclazi
Copy link

eclazi commented Nov 18, 2016

If the .terminator variable is set to "\n", "\r\n" will still be used in the output on windows.

Following can be used to reproduce.

GSL

.output "test.html"
.terminator="\n"
<html>
</html>

XML

<?xml version="1.0"?>
<test script = "test.gsl" >
</test>
@eclazi
Copy link
Author

eclazi commented Nov 18, 2016

So I see that Windows automatically converts LF to CR.

The only solution I have found is to change open_output_file to use binary output modes. However I'm not sure if there would be any consequences to this.

The reason why this has come up is I am trying to use zproject on Windows, but it changes the line endings to the files in the repo.

@evoskuil
Copy link
Member

Hi @Jossgray. It is true that GSL hard-wires a replacement of \n to \r\n when writing files on a Windows system. I spent some time on this problem recently. I came very close to pushing an inelegant (but backward compatible) hack but decided against it. I had the same problem as you and decided it was better to just let git do its thing with line endings. This works quite well once configured, and it deals with the issue in files not generated by GSL as well. Hope this helps.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants