L A Walsh <w...@tlinx.org> writes: >> But of course, no URL contains an embedded space. > --- > Why not?
Because that's what it says in RFC 3986, which is what *defines* what a URL *is*. Now, someone can provide a string that contains spaces and claim it's a URL, but it isn't. The question is, What to do with it? My preference is to barf and tell the user that what they provided wasn't a proper URL. Beyond that, one might do some simple tidying up, such as removing leading and trailing spaces. That fix, by the way, is known to be safe, *because a URL can't contain a space*, and so any trailing space can't actually be part of the URL. It gets uglier when there are invalid characters in the middle of the URL, because simply deleting them is unlikely to produce the results the user expected. Dale