If you're writing the strings like you've shown above with 'my text....' + #10#13 + 'other text...'
, your problem is that you have your line ending characters reversed. On Windows, they should be #13#10
(or simply use the sLineBreak
constant).
Here's a quick app (Delphi XE2) that demonstrates that the bad order of the pair will cause the problem, and a way to fix it:
program Project1;
{$APPTYPE CONSOLE}
uses
SysUtils, Classes;
var
SL: TStringList;
begin
SL := TStringList.Create;
try
SL.Add('This is a test string' + #10#13 + 'This is another test string');
SL.SaveToFile('C:\Test\BadLFPair.txt');
SL.Clear;
SL.Add('This is a test string'+ #13#10 + 'This is another test string');
SL.SaveToFile('C:\Test\BadLFPairFix.txt');
finally
SL.Free;
end;
end.
The first, when opened in Notepad, produces:
This is a test stringThis is another test string
The second:
This is a test string
This is another test string