Extended newline replacement to handle Windows-style CRLF newlines