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,639
  • 133
  • 442
  • 830

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,525
  • 1
  • 14
  • 24