Sean
|
| Posted: 03/23/2002, 1:50 PM |
|
Hi, I'm having some probs with entered urls with spaces in them creating bad links. For example, a user enters a link.. http://www.mysite.com/folder/this file.html ... the %20 that the page spits out for the space between 'this file'.html is making the link bad. Any ideas?
/sean
|
|
|
 |
Brent
|
| Posted: 03/24/2002, 1:39 PM |
|
You didn't say what language you were using or if you used the url as a parameter.
If you are using PHP check out the functions addslashes(), stripslashes(),urlencode,urldecode,
and htmlspecialchars.
|
|
|
 |
Sean
|
| Posted: 03/24/2002, 2:39 PM |
|
Sorry, it's in asp. the url is pretty straight forward as a parameter I guess...
for example.. http://jereme.gfxsites.net/tutorials/chrome%20tentacles...20tentacles.php
the %20's are spaces
|
|
|
 |
Brent
|
| Posted: 03/24/2002, 5:04 PM |
|
Then if it were PHP you would use:
$url = urldecode($url);
and this will remove the %## encoding from the string. ASP probably has a similar function.
|
|
|
 |
Sean
|
| Posted: 03/27/2002, 10:49 AM |
|
Anyone have any ideas how to accomplish this in asp?
|
|
|
 |
Brent
|
| Posted: 03/27/2002, 12:54 PM |
|
According to an ASP website it is URLEncode.
See: http://www.sloppycode.net/asp/?m=39 http://www.w3schools.com/asp/met_urlencode.asp
There is also HTMLEncode http://www.fuzzysoftware.com/tagreference.asp?objectid=5&tagid=38
|
|
|
 |
Don
|
| Posted: 04/25/2002, 6:27 PM |
|
Spaces in URLs are not standard and are not supported by any browser as far as I know. Certainly you cannot have them in the URL or file name itself but if you are trying to send them as a query string after the URL, the spaces need to be filled with + which is done with some kind or URL encoding. The programming language has nothing to do with the problem but how you URL encode it does. But regardless, this file.html will always be invalid.
Don
|
|
|
 |