End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
class method
URI.encode_www_form_component
encode_www_form_component(str, enc=nil)
lib/uri/common.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.2.0/lib/uri/common.rb, line 328
def self.encode_www_form_component(str, enc=nil)
_encode_uri_component(/[^*\-.0-9A-Z_a-z]/, TBLENCWWWCOMP_, str, enc)
end
Encodes given str to URL-encoded form data.
This method doesn’t convert *, -, ., 0-9, A-Z, _, a-z, but does convert SP (ASCII space) to + and converts others to %XX.
If enc is given, convert str to the encoding before percent encoding.
This is an implementation of www.w3.org/TR/2013/CR-html5-20130806/forms.html#url-encoded-form-data.
See also
.encode_www_form
.extract
.encode_uri_component
.for
also in
4.1 · 4.0 · 3.4 · 3.3 · 3.1 · 3.0