在Rails 3(
Ruby 1.9.2)中,我发送请求
Started GET "/controller/action?path=/41_+"
但参数列表如下所示:
{"path"=>"/41_ ","controller"=>"controller","action"=>"action"}
这里出了什么问题? –,*或.标志工作正常,它只会被一个空格所取代.
解决方法
这是正常的URL编码,the plus sign is a shorthand for a space:
Within the query string,the plus sign is reserved as shorthand notation for a space. Therefore,real plus signs must be encoded. This method was used to make query URIs easier to pass in systems which did not allow spaces.
The character is a U+0020 SPACE character Replace the character with a single U+002B PLUS SIGN character (+).