Skip to content

Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →

instance method

CGI::Util#unescape_uri_component

unescape_uri_component(string, encoding = @@accept_charset)

Alias of #unescapeURIComponent

URL-decode a string following RFC 3986 with encoding(optional).

Example
string = CGI.unescapeURIComponent("%27Stop%21%27+said%20Fred")
   # => "'Stop!'+said Fred"