Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

CGI::Util#escapeHTML

escapeHTML(string)

Escape special characters in HTML, namely ‘&\“<>

Example
CGI.escapeHTML('Usage: foo "bar" <baz>')
   # => "Usage: foo &quot;bar&quot; &lt;baz&gt;"
See also #escape_html #h #escapeElement #pretty also in 3.4 · 3.3 · 3.2 · 3.1