Actually, it doesn't work well.
If I have a text file with a bunch of lines one after the other, your code will work. However, if I have a text file including empty lines, those empty lines are completed removed when using that code. I need to preserve them as they are part of the text. What I need to avoid is the weird behavior of the LF which was included in my previous version.