I'll tell you, as a user of editors, I don't want my newlines changed. I run Linux and when I edit a windows file, I'm doing it for a good reason and I want the new newlines to be the same as the newlines that were there when I opened the file. Which is what happens with both emacs and gedit. If that's not what happens, I look for a new editor.
As far as detecting the value of \n, I think you're trying too hard not to reinvent the wheel. Deciding which of the 3 endings a file uses is, imho, a job for a regex, not a module.
Personally, I've never encountered a file where mixed newline types would be anything be a corrupt file. For fun, I'll imagine printing a file for a win client out of a mod_perl module that runs on linux. Well, the windows EOL would be contained in quotes and/or escaped so the obvious *NIX dominance should prevail. Of course, I could be missing an important use case here.
That said, an option to convert EOL to various formats would be a nice option to offer.
In reply to Re: maintaining newlines in file
by rowdog
in thread maintaining newlines in file
by szabgab
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |