I can see the problem now. The code uses CR followed by CRLF on every line. This was probably some kind of unix -> windows EOL conversion bug. Either CRLF or CR's should be killed (personally I'm ok with unix endlines).