On Fri, Jan 06, 2012 at 03:03:12PM -0500, Steve King wrote:
On 2012-01-06 13:15, Eric Hall wrote:
We've discovered (naturally in an unpleasant way) that TM (1.5.10) will translate CR (0x0d) in a file to LF (0x0a) on save - even when the Line Endings setting "Use for existing files as well" is not checked. This seems like a bug, as it seems the settings are to leave existing files alone with respect to potential line ending characters. Is this a known issue?
[snip]
Is it possible that your original file started with mixed line endings? In that case I think TM will either save the file with your default line ending rather than trying to preserve the inconsistencies. Here's a file with mixed line endings; first CRLF, then CR, then LF.
Yes, this is the case here (sorry, I'd meant to mention that) - we have files with LF line endings, a few wound up with CRs in the lines due to the data involved. Thus we've got text files with LF line endings and a CR (one or more) in the middle of some of the lines.
My simple example (note the cr after the colon):
% od -a CRtoNL.txt 0000000 T h i s sp i s sp t h e sp t e s t 0000020 : cr sp sp a n d sp s h o u l d sp a 0000040 l l sp b e sp o n e sp l i n e nl 0000057
Open the above with TextMate and save (no need to add another line):
% od -a CRtoNLTMSaved.txt 0000000 T h i s sp i s sp t h e sp t e s t 0000020 : nl sp sp a n d sp s h o u l d sp a 0000040 l l sp b e sp o n e sp l i n e nl 0000057
-eric