On Jul 31, 2006, at 7:27 PM, Charles O Nutter wrote:

> A large part of our problem is that we currently tend to normalize
> everything to \n....all the time. That has the effect of also  
> writing out \n
> to the filesystem for newlines, which as you describe above causes  
> problems
> when trying to re-read. So for the case in question, we run Rails...it
> generates files with newlines...we normalize those newlines to \n  
> and write
> such to disk...and then future use of those files (in this case, ERB
> templates) fails because the newlines aren't handled correctly  
> (i.e. we
> can't normalize \r\n to \n again because they're already \n on disk).

If those files are only handled by that application there is no  
problem because \ns are precisely what the script should see.

For instance, if you pass a Unix text file to a line-oriented script  
running on Windows the script will work as long as it only reads.  
That's because LFs not following a CR are left untouched by the I/O  
layer, and by a happy coincidence LFs is what readline expects. So  
everything works, by chance, but works.

Problem is the application generates text files that do not follow  
the conventions of the platform, and other programs may assume they do.

-- fxn