I have some issue in passing a FTP string into QUrl:
std::cout << QUrl::fromUserInput("ftp://user@host.com:password@ftphost:21/path/file.ext").toString().toStdString().c_str() << std::endl;
Is always resulting in
http://ftp//user@host.com:password@ftphost:21/path/file.ext
which is obviously wrong. What's the problem with the above FTP Url? Or is that a known issue within Qt4?
I am working on Linux, using Qt 4.8.1.
Even following code
if(QUrl("ftp://user@host.com:password@ftphost:21/path/file.ext").isValid())
std::cout << "is valid" << std::endl;
else
std::cout << "is not valid" << std::endl;
Is resulting in "is not valid"
Thanks in advance
You need manually replace @
in username with %40
. That's what QUrl does internally if QUrl::setUserName() is called with user@domain.tld
.