Thank you for this article. Just a week ago I was tearing my hair out, raving and ranting “why the hell aren’t those unicode standards c*&k s&#%#@s smart enough to create a universal cross platform CR/LF/CRLF equivalent!!!”
The reason being. I was doing work on an Open Source .NET library called Packet.net, where my work was being done using VS2008 in Windows and the project admin was working in MD using *nix.
git has a hackish solution (autocrlf) to automatically convert ASCII line ending issues but it sucks. I.E. If a file with mixed line endings accidentally gets through in a commit, you’re SOL. So, I was forced to resolve them myself.
In VS2008 line endings are handled based on the type already used in the file. For instance, if the file was created in *nix, it handles the line endings as LF. If it sees inconsistent line endings (or if it randomly feels like seeing if it can trick you into changing to windows CRLF line endings) it pops up the menu you illustrated.
The major shortcoming of VS2008 on handling line endings can be seen if one of the project XML files needs modification (Ex. settings, .vsproj, etc…). Since those are automatically generated by VS they always write line endings as CRLF. Which lead me to my final evaluation. VS sucks at line endings.
After getting tired of opening .csproj files in Notepad++, and converting the line endings manually. Or, having patches rejected because I forgot to convert a file. I finally threw in the towel and partitioned my HDD to work as a dual Windows/LinuxMint.
Long story (not-so)short. Creating the source files in unicode and using LS as the default line ending would completely solve this issue. No more line ending woes. Now, I wonder if both VS and MD both support it. This article (and discovering the LS char), finally gave me a viable reason to use unicode.
::NepoleonDynamiteSigh:: I was much happier in the days when I was still ignorant of what the term “line ending” meant.
SideNote: It’s still useful to have LF work as linefeed. Mostly in interactive console apps where you’re trying to update a status during processing. Instead of doing a ClearScreen and reprinting all the lines with the status updated, or printing a new line for every update (filling the screen with updates) you can just to print(LF) followed by the updated message and overwrite it to the same line.
I know the “Home” key on the keyboard is useless to 99.7% of average computer users, but I use it all the time.