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.0.0/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