When I try to open any site that has double-quotes (") inside the link , for ex. user.php?name="stackoverflow" it just cuts " or sometimes it redirects me to Google!?
Used code:
ShellExecute(0, 'open', PChar('open'), PChar(URL), nil, SW_SHOW) ;
You need use a fully qualified
URLincluding thehttp://and escape/encode theURLby replacing the double-quotes (") with%22.Also you are passing wrong parameters.
See MSDN: Use ShellExecute to launch the default Web browser
Example:
You should always encode the URL parameters, not only double-quotes. You can use Indy with
TIdURI.URLEncode–IdURIunit.You could also use
HTTPEncodefrom theHTTPAppunit to encode each parameter in theURL.Note that
TIdURI.URLEncodewill encode the?and the&separators also. so I think it’s a better idea to encode each parameter separately withHTTPEncodee.g: