'D' is actually 0D and if you look it up at asciitable.com, it's a carriage return (and not a linefeed). Change your endmarker to '\r' (or 0x0D) and it should work.
'D' is actually 0D and if you look it up at asciitable.com, it's a carriage return (and not a linefeed). Change your endmarker to '\r' (or 0x0D) and it should work.