Unsolved QUrl treats ip address octets as octal for leading zeros
-
QString urlStr;
urlStr = "ws://" + "192.168.001.040" + ":" + 4001;
QUrl url(urlStr);
qDebug() << "urlStr=" << urlStr;
qDebug() << "url=" << url.toString();output with qt5.10.0
urlStr="ws://192.168.001.040:4001"
url="ws://192.168.1.32:4001"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.