My webapp lets users download text files. Currently the text files have Unix-style \n
line endings, and as a result, when opened in Notepad on Windows (and probably other Windows utilities), the line breaks are missing. Because of the popularity of Notepad among my users, I am thinking of changing the line endings to a Windows-style \r\n
. But will that cause some kind of problems on non-Windows platforms or alternative editors?
(Side comment: it so happens that these files are being generated on the fly, so I could condition the line ending format on the user's OS, but at this point I'm trying to be minimalistic, and also just curious in general. Using Django, by the way.)
I think the best option is to let your users decide. Give them a dropdown box to choose Windows/UNIX/Mac style line endings. You can keep the files normalized to UNIX style endings since they are the easiest to work with.
I am not sure if you can generate text files with a universal style of line endings. Most tools like git normalize their files and leave the users to configure which style of output they prefer. Jeff has written a great article on line endings which goes into some historical context.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With