When to encode space to plus (+) or ?

前端 未结 5 1674
北恋
北恋 2020-11-22 02:12

Sometimes the spaces get URL encoded to the + sign, some other times to %20. What is the difference and why should this happen?

5条回答
  •  春和景丽
    2020-11-22 02:37

    http://www.example.com/some/path/to/resource?param1=value1

    The part before the question mark must use % encoding (so %20 for space), after the question mark you can use either %20 or + for a space. If you need an actual + after the question mark use %2B.

提交回复
热议问题