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_uri_component
_encode_uri_component(regexp, table, str, enc)
lib/uri/common.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.2.0/lib/uri/common.rb, line 355
def self._encode_uri_component(regexp, table, str, enc)
str = str.to_s.dup
if str.encoding != Encoding::ASCII_8BIT
if enc && enc != Encoding::ASCII_8BIT
str.encode!(Encoding::UTF_8, invalid: :replace, undef: :replace)
str.encode!(enc, fallback: ->(x){"&##{x.ord};"})
end
str.force_encoding(Encoding::ASCII_8BIT)
end
str.gsub!(regexp, table)
str.force_encoding(Encoding::US_ASCII)
end
No documentation available
See also
.decode_www_form_component
.encode_uri_component
.decode_www_form
.encode_www_form
also in
4.1 · 4.0 · 3.4 · 3.3