[Interest] QTextStream, QIODevice::Text and line endings convertation

Thiago Macieira thiago.macieira at intel.com
Tue Nov 17 22:58:24 CET 2015


On Tuesday 17 November 2015 23:46:49 Igor Mironchik wrote:
>      QString data = QLatin1String( "/*** Program Name ***/\r\n"
>          "TEST PROGRAM TEST_00;\r\n"
>          "BEGIN\r\n"
>          "LOGIC\r\n"
>          "NAME :\r"
>          "ACTUAL_NAME\r\n"
>          "OPTION ENABLE : " );

> And output is:
> 
> "/*** Program Name ***/"
> 
> "TEST PROGRAM TEST_00;"
> 
> "BEGIN"
> 
> "LOGIC"
> 
> "NAME :ACTUAL_NAME"
> 
> "OPTION ENABLE : "
> 
> 
> Look here "NAME :ACTUAL_NAME" '\r' wasn't converted to '\n'...

Never mind the other email. I see what you mean now.

It's not a bug. Only CRLF is a converted to LF. A lone CR does not count as a 
line break.

What version of Qt did you use for this? I would expect it to show the string 
slash-r in the qDebug output.
-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Interest mailing list