From: James Edward Gray II Date: 2009-08-24T06:00:46+09:00 Subject: Re: 1.8.7 String#lines keeps new-line chars (say it ain't so in 1.9) On Aug 23, 2009, at 3:48 PM, Trans wrote: > On Aug 23, 3:32 am, Brian Candler wrote: > >> Perhaps most importantly of all, if the newlines were stripped, there >> would be loss of data and it would be impossible to reconstruct the >> original file exactly from the members of the lines array (e.g. >> lines.join), as your example shows nicely. > > How is there loss of data, when you know what was removed? Just join > ("\n"). What do we do for lines ending in \r\n? Do we take both or just the \n? I say both would be the most consistent, but then you don't know if you need to put back a \r\n or just an \n. Also, how do you know if the last line ended in a \n? join("\n") wouldn't put it back in either case. James Edward Gray II