encode_uri_component(str, enc=nil) -> StringRuby 3.2 から[permalink][rdoc][edit]-
文字列 str をパーセントエンコードした文字列を返します。
URI.encode_www_form_component と同様の変換を行いますが、空白文字 " " を "+" ではなく "%20" に変換する点が異なります。
- [PARAM]
str: - エンコードする文字列です。
- [PARAM]
enc: - 指定された場合、パーセントエンコーディングする前に、str をこのエンコーディングに変換します。
require 'uri' p URI.encode_uri_component('Ruby is fun+test') # => "Ruby%20is%20fun%2Btest"[SEE_ALSO] URI.decode_uri_component, URI.encode_www_form_component
- [PARAM]