Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QUrl treats ip address octets as octal for leading zeros
Bill Priest last edited by
urlStr = "ws://" + "192.168.001.040" + ":" + 4001;
qDebug() << "urlStr=" << urlStr;
qDebug() << "url=" << url.toString();
output with qt5.10.0
Clearly QUrl is treating 040 as octal and getting 32. This wasn't what I was expecting.
I don't see an error here esp. because this is exactly what firefox is doing...
/edit: an chrome and internet explorer
Interesting - I didn't know this. Seems the octal representation never dies ;)
@Bill-Priest: As some comments on https://superuser.com/questions/857603/are-ip-addresses-with-and-without-leading-zeroes-the-same/857787 state, the IP stack functions inet_addr and inet_aton lead to this behavior, which is therefore common for many tools.
So no Qt bug, much more surprising behavior.