Jump to content

Url Encode A Space


lanmind

Recommended Posts

Hello,I have some user submitted data that becomes part of a html file name and so in turn will be displayed as a URL across different browsers. I allow the submitted data to contain the URL illegal space character. When I submit it using my Firefox browser the space is automatically encoded to a "+". I'm not sure if this happens with every browser so I'm wondering if I need to encode any space characters before sending them to my server script.Thank you for your time.

Link to comment
Share on other sites

I'm sorry I worded my question wrong. What I wanted to ask was:Do you think I need to URL encode space characters as they are illegal in URLs?I figured that I do because if a user submits "user name" it will become part of the html file name like so: user name.html. Of course spaces are illegal in URLs so the address http://www.example.com/userpages/user name.html would return a 404 error.Thank you.

Link to comment
Share on other sites

For paths, yes, but for form fields, + is the convention, and all browsers will encode it like that. I'm sure there's a reason somewhere.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...