How do I change the default newline character from Windows \r\n to Unix style \n? Ideally I change the Environment somehow and have it done globally so I don’t need to modify a bunch of string/textwriter code.
How do I change the default newline character from Windows \r\n to Unix style
Share
Unfortunately this is not really doable. The primary way by which developers embed new lines in their application is by using
Enviornment.NewLine. This is a static property which returns Window style new linesThere is no way to modify the return of this property from your code.
Your best option for changing new line endings is to develop a library which converts known sources of embedding Windows new lines to unix ones. For example a stream and string converter would likely be in order.