Quote Originally Posted by vsthakur1 View Post
How to deal with “)” character in the URL , so that is is not broken ?
Use QUrl to build the URL in the first place (rather than pasting strings together). You'll find it does the encoding work for you.

You will also find the open and close parentheses are perfectly legal characters in the query portion of a URL, but spaces are not.
http://tools.ietf.org/html/rfc3986 (Section 3.4, 3.3, and 2.2)

Qt Code:
  1. QUrl url;
  2. url.setScheme("http:");
  3. url.setHost(ipAddress);
  4. url.setPort(13007);
  5. url.setPath(QString("%1.ppm").arg(folder));
  6. url.addQueryItem("filepath", QString("%1/FIRMWARE").arg(applicationDirPath));
  7. qDebug() << url.toEncoded();
  8. // "http:://127.0.0.1:13007/some%20folder.ppm?filepath=C:/Program%20Files(x86)/SomeApplication/FIRMWARE"
To copy to clipboard, switch view to plain text mode 

Different systems are tolerant of badly formed URLs to different degrees, and incorrectly handle valid URLs also. If you are faced with a broken consumer of the URL then you can do this:
Qt Code:
  1. url.addEncodedQueryItem(
  2. QUrl::toPercentEncoding("filepath"),
  3. QUrl::toPercentEncoding(QString("%1/FIRMWARE").arg(applicationDirPath))
  4. );
  5. qDebug() << url.toEncoded();
  6. // "http:://127.0.0.1:13007/some%20folder.ppm?filepath=C%3A%2FProgram%20Files%28x86%29%2FSomeApplication%2FFIRMWARE"
To copy to clipboard, switch view to plain text mode 
to be extra sure.