Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
URI::RFC2396_Parser#unescape
(::String str, ?::Regexp escaped) -> ::String
unescape( str )
unescape( str, escaped )
lib/uri/rfc2396_parser.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/lib/uri/rfc2396_parser.rb, line 317
def unescape(str, escaped = @regexp[:ESCAPED])
enc = str.encoding
enc = Encoding::UTF_8 if enc == Encoding::US_ASCII
str.gsub(escaped) { [$&[1, 2]].pack('H2').force_encoding(enc) }
end