加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – Rails:加上用空格替换GET-Request

发布时间:2020-12-16 19:45:13 所属栏目:百科 来源:网络整理
导读:在Rails 3( Ruby 1.9.2)中,我发送请求 Started GET "/controller/action?path=/41_+" 但参数列表如下所示: {"path"="/41_ ","controller"="controller","action"="action"} 这里出了什么问题? –,*或.标志工作正常,它只会被一个空格所取代. 解决方法 这是
在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.

并从HTML5 standard:

The character is a U+0020 SPACE character Replace the character with a single U+002B PLUS SIGN character (+).

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读