るりまサーチ

最速Rubyリファレンスマニュアル検索!
24件ヒット [1-24件を表示] (0.259秒)
トップページ > クエリ:spec[x] > クエリ:decode_www_form[x]

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

ライブラリ

モジュール

検索結果

URI.decode_www_form(str, enc=Encoding::UTF_8) -> [[String, String]] (18119.0)

文字列から URL-encoded form data をデコードします。

...メソッドは
https://url.spec.whatwg.org/#concept-urlencoded-parser
にもとづいて実装されています。
そのため「&」区切りのみに対応していて、「;」区切りには対応していません。

require 'uri'
ary = URI.decode_www_form("a=1&a=2&b=3")
p ary...
...y.assoc('b').last #=> '3'
p Hash[ary] #=> {"a"=>"2", "b"=>"3"}

@param str デコード対象の文字列
@param enc エンコーディング
@raise ArgumentError str のフォーマットが不正である場合に発生します
@see URI.decode_www_form_component, URI.encode_www_form...

URI.encode_www_form(enum, enc=nil) -> String (12.0)

enum から URL-encoded form data を生成します。

...はありません。

このメソッドは内部的に
URI.encode_www_form_component
を使っています。

このメソッドは
https://url.spec.whatwg.org/#concept-urlencoded-serializer
にもとづいて実装されています。

@param enum エンコードするデータ列([key, value]...
...という形のデータの列)
@param enc 指定された場合、パーセントエンコーディングする前に、このエンコーディングに変換
@see URI.encode_www_form_component, URI.decode_www_form...