My desktop application should download the file from the Internet. The file path is known, the file name itself is half-variable, i.e. Someone will post new files there, and my application will have to download them.
Now I want to make sure that the URL is safe and that it will be interpreted correctly. Also, if the file name has "#" (you never know), I want it to be encoded. Javascript has two different functions for this: encodeURI and encodeURIComponent . The latter also encodes the characters "#", among other things. Of course, I could fold my own, but I decided that theres must be functions ready for this, and I could also avoid some old mistake.
I will upload the file using an object that uses a number of WinInet API functions ( InternetOpen , etc.).
So, I started rummaging through MSDN and, of course, theres UrlCanonicalize . But there is also UrlEscape , CreateUri (but this is not present in Delphi 2010 divisions) and, finally, InternetCreateUrl , in which I need to share the entire URL. Id rather combines the first part of the URL with the name URLEncoded filename.
In addition, all of them have many different flags, different default values ββthat changed during the versions of Windows, and I can no longer figure out the differences. Does anyone know which one is better for this purpose?
source share