Skip to content

Maintenance Ruby 3.3 gets fixes, but no new features. 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;"