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

在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 (+).

相关文章

validates:conclusion,:presence=>true,:inclusion=>{...
一、redis集群搭建redis3.0以前,提供了Sentinel工具来监控各...
分享一下我老师大神的人工智能教程。零基础!通俗易懂!风趣...
上一篇博文 ruby传参之引用类型 里边定义了一个方法名 mo...
一编程与编程语言 什么是编程语言? 能够被计算机所识别的表...
Ruby类和对象Ruby是一种完美的面向对象编程语言。面向对象编...