Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

instance method

CGI::Escape#unescape_element

(::string string, *::String | ::Array[::String] elements) -> ::String
unescape_element(string, *elements)

Alias of #unescapeElement

Undo escaping such as that done by CGI.escapeElement

Example
print CGI.unescapeElement(
        CGI.escapeHTML('<BR><A HREF="url"></A>'), "A", "IMG")
  # "&lt;BR&gt;<A HREF="url"></A>"

print CGI.unescapeElement(
        CGI.escapeHTML('<BR><A HREF="url"></A>'), ["A", "IMG"])
  # "&lt;BR&gt;<A HREF="url"></A>"