Re: %20 and spaces in a URL
Fred Holmes fsh at cpcug.org writes: If I have a URL that has %20 in place of spaces, and I use the URL directly as the argument of WGET, it seems that the file is always not found. I've discovered that if I replace each %20 with a space, and put quotation marks around the entire URL, it works. . . . This topic is of interest to me, since I am using wget in a Windows XP command shell, to fetch files from a HTTP server. A number of the file names have spaces in them and in the url these were replace by %20; these files did not successfully download. What I realized is that the % character is not protected by using double quotes surrounding the url. I could see this by having echo on as the first line of my command file. The escape character ^ that protects other special characters in the command shell doesn't help in the case of %. What does seem to work is to replace %20 by %%20. I am not a subscriber to wget@sunsite.dk so please include my email address in replies.
Re: %20 and spaces in a URL
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Alan Wehmann wrote: Fred Holmes fsh at cpcug.org writes: If I have a URL that has %20 in place of spaces, and I use the URL directly as the argument of WGET, it seems that the file is always not found. I've discovered that if I replace each %20 with a space, and put quotation marks around the entire URL, it works. . . . This topic is of interest to me, since I am using wget in a Windows XP command shell, to fetch files from a HTTP server. A number of the file names have spaces in them and in the url these were replace by %20; these files did not successfully download. What I realized is that the % character is not protected by using double quotes surrounding the url. I could see this by having echo on as the first line of my command file. The escape character ^ that protects other special characters in the command shell doesn't help in the case of %. What does seem to work is to replace %20 by %%20. I am not a subscriber to wget@sunsite.dk so please include my email address in replies. I'm not sure what sort of replies you are looking for, as you haven't asked a question. :) It is, of course, the responsibility of the user to ensure that he properly escapes characters that he wants to pass literally to Wget. Note that it's not necessary to convert space characters to %20; simply putting quotes around the whole URL to protect the spaces from becoming field separators for the shell is quite enough. Also, when you quote from a three-year-old comment, it's usually advisable to mention a little more about the context of the message, and where we can find the original thread. But, yeah, if your shell treats % specially, then obviously you need to escape them. This has nothing in particular to do with Wget, but rather with using whatever particular command shell you have. - -- Micah J. Cowan Programmer, musician, typesetting enthusiast, gamer... http://micah.cowan.name/ -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHIjv57M8hyUobTrERCLyEAJ9Gs5lS9qphZNrlYAz44PaldobFegCfcxC7 x7jIj/DgL+xZt2gXFfcf1No= =CmqR -END PGP SIGNATURE-
Re: %20 and spaces in a URL
Fred Holmes [EMAIL PROTECTED] writes: But I want WGET to convert %20 to space (I think). Why would you want that? A URL with a literal space is illegal, at least for HTTP -- Wget would have to convert the space to %20 to be able to send the URL to the HTTP server anyway. OTOH, if you're talking about *file* names, %20 should already be converted to space.
Re: %20 and spaces in a URL
But I want WGET to convert %20 to space (I think). I'm using 1.9.1. I haven't checked to see if there is a new stable version. I'm using the windows binary. I'd love to go linux, but the startup transient is too much. (And the computer they furnish me at work is Windows) I regularly use WGET to download a file that is referenced in my work, so that the file is just downloaded and not opened by my browser into its viewing application. For large files the download seems to go much faster as well. Thanks, Fred Holmes At 09:01 PM 5/20/2004, Hrvoje Niksic wrote: Fred Holmes [EMAIL PROTECTED] writes: If I have a URL that has %20 in place of spaces, and I use the URL directly as the argument of WGET, it seems that the file is always not found. I've discovered that if I replace each %20 with a space, and put quotation marks around the entire URL, it works. That's weird. Wget converts space to %20, so I don't see any difference between using space and %20. Are you sure the URLs are otherwise the same? What version of Wget are you using?
Re: %20 and spaces in a URL
At 04:55 AM 5/21/2004, Hrvoje Niksic wrote: OTOH, if you're talking about *file* names, %20 should already be converted to space. Yes, these URLs are for files, e.g., .pdf and .doc and .zip files. When I get to work today, if I can make a few minutes of time, I'll post an explicit example (or discover my error, I hope). I don't mean literally change to spaces, just parse the %20 correctly so that the file is in fact found and downloaded. I'm downloading single files, references on Google, using WGET instead of the browser. Thanks for your help. Fred Holmes
Re: %20 and spaces in a URL
Fred Holmes [EMAIL PROTECTED] writes: If I have a URL that has %20 in place of spaces, and I use the URL directly as the argument of WGET, it seems that the file is always not found. I've discovered that if I replace each %20 with a space, and put quotation marks around the entire URL, it works. That's weird. Wget converts space to %20, so I don't see any difference between using space and %20. Are you sure the URLs are otherwise the same? What version of Wget are you using?