다음을 통해 공유


Url Encoding, It's Not Just For Breakfast Anymore

I overheard two of my coworkers the other day talking about it and I actually ran into it myself the other day.  What am I talking about?  Its the common practice to use encode urls spaces as '-' when the standard says they should be '+'. 

For example:

https://www.engadget.com/2006/07/21/zune-what-we-know-think-we-know-and-dont-yet-know/

I think it is weird for this to happen.  Both the php urlencode function and the asp.net Server.UrlEncode function do not do this, they will convert spaces to '+'. 

So these begs the question of, why do they do this?

My best guess, just because it looks better.  I think search engines caught on and now will treat '-' as a space when they parse the urls for keywords, which is to bad for things that actually have a '-' in their keywords.

Comments

  • Anonymous
    March 06, 2008
    I don't know about PHP, but the ASP.NET Server.UrlEncode function replaces spaces with "+", not "-".
  • Anonymous
    March 06, 2008
    Typo, thanks for pointing it out!
  • Anonymous
    March 07, 2008
    The comment has been removed