Proper handling of various line terminators.

CR ('\r'), LF ('\n'), CRLF ('\r\n') are all recognized and preserved.