My application reads and parses text files. Some of these text files have a combination CR/LF as a line ending and I need to conserve those line ending characters - or at least replace them with the same number of white space characters.
I am using a text input stream to read a line at a time and see that the CR/LF characters are being replaced with a single space.
Is there a special encoding i can use that will preserve the original CR/LF characters or replace them with 2 white space characters ?
ReadLine - by definition - splits the text up at line endings (regardless)
So you cant know for sure which line ending was in use
A single file could mix them
I forget if readline will handle that or if it just sticks to the first one found
Either read the whole file at once or read it in large chunks ignoring the end of lines into a long string
Then you could use ReplaceAll in 3 passes to replace
CR/LF with 2 spaces + EndofLine
CR with one space + EndOfline
LF with one space + ENdOfLIne
Then split the whole thing on “EndOfLIne” so you have the spaces & split lines