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

Thiago Macieira thiago.macieira at intel.com
Wed Nov 18 09:15:17 CET 2015


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".
-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Interest mailing list