1

I’m using Ruby on Rails 4.2.7. How do I take an encoded query string, like

submitbutton=View&a=b&d=%26%26

and turn it into a hash of name value pairs in which the values are url-unencoded?

Dave
  • 15,914
  • 110
  • 364
  • 695

1 Answers1

3

You can use CGI.parse

CGI.parse('submitbutton=View&a=b&d=%26%26')
#=> {"submitbutton"=>["View"], "a"=>["b"], "d"=>["&&"]}
Bartłomiej Gładys
  • 4,435
  • 1
  • 11
  • 20