Why should I use urlencode?

后端 未结 6 1166
别那么骄傲
别那么骄傲 2020-11-27 03:41

I am writing a web application and learning how to urlencode html links...

All the urlencode questions here (see tag below) are \"How to...?\" questions.

M

6条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-27 04:09

    Two reasons I could think of:

    • It really depends on how you parse your query server side. E.g. passing parameters using HTTP's GET request will have problems if there are characters like & inside some parameter.
    • It allows you to handle non-ansi characters the way you'd like to (you dictate the encoding). Otherwise the browser might pass them in some random encoding (don't think it's really defined in any standard; correct me if I'm wrong).

提交回复
热议问题