Why do you need to encode URLs?

后端 未结 5 1219
没有蜡笔的小新
没有蜡笔的小新 2020-12-08 04:16

Why do you need to encode urls? Is there a good reason why you have to change every space in the GET data to %20?

5条回答
  •  鱼传尺愫
    2020-12-08 04:31

    • originally older browsers could get confused by the spaces (not really an issue anymore).
    • now, if someone copies the url to send as a link - the space can break the hyperlink - ie

    Hey! Check out this derping cat playing a piano!

    http://www.mysite.com/?video=funny cat plays piano.
    

    See how the link breaks?

    Now look at this:

    http://www.mysite.com/?video=funny%20cat%20plays%20piano.
    

提交回复
热议问题