PDA

View Full Version : QTextEdit End-of-Line character



smhall316
29th September 2010, 17:35
FYI - I am using PyQt4

I am loading a simple text file into a QTextEdit. I have noticed that when I try to read back each block of text it never returns the end-of-line character when I print repr(block.text()), where block is my QTextBlock for a given line.

I physically printed each character at every position in the QTextEdit and saw that, where the new line character ('\n') was in the text file, the QTextEdit replaced with 0x2029, the paragraph separator. Is there a way to make the QTextEdit place the physical newline character in the document? I want to be able to figure out which type of End-of-line character is on each line of text, since a text document could have any one of the three types of EOL characters.

Thanks for any help

Lykurg
29th September 2010, 18:28
As long as I know, QTextEdit transform all line endings to "\n". So you cant figure out, what line ending was used originally. After saving the editor contend back you always have a single \n.