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

Igor Mironchik igor.mironchik at gmail.com
Wed Nov 18 20:25:45 CET 2015



On 18.11.2015 11:15, Thiago Macieira wrote:
> On Wednesday 18 November 2015 09:57:08 Igor Mironchik wrote:
>> 11/18/2015 12:58 AM, Thiago Macieira пишет:
>>> 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.
>> Qt 5.5.1
> It should have printed "NAME :\rACTUAL_NAME".

May be. I've just copy-pasted that what was printed in QtCreator...

-- 
Best Regards,
Igor Mironchik.




More information about the Interest mailing list