method
decode_www_form
v2_6_3 -
Show latest stable
-
0 notes -
Class: URI
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378
- 1_9_2_180 (0)
- 1_9_3_125 (0)
- 1_9_3_392 (0)
- 2_1_10 (-38)
- 2_2_9 (0)
- 2_4_6 (4)
- 2_5_5 (0)
- 2_6_3 (1)
- What's this?
decode_www_form(str, enc=Encoding::UTF_8, separator: '&', use__charset_: false, isindex: false)
public
Decodes URL-encoded form data from given str.
This decodes application/x-www-form-urlencoded data and returns an array of key-value arrays.
This refers http://url.spec.whatwg.org/#concept-urlencoded-parser, so this supports only &-separator, and doesn’t support ;-separator.
ary = URI.decode_www_form("a=1&a=2&b=3") ary #=> [['a', '1'], ['a', '2'], ['b', '3']] ary.assoc('a').last #=> '1' ary.assoc('b').last #=> '3' ary.rassoc('a').last #=> '2' Hash[ary] #=> {"a"=>"2", "b"=>"3"}
See URI.decode_www_form_component, URI.encode_www_form.