WebEscape
Constants
HTML_UNSAFE_IN_SCRIPT = {'<' => "\\u003c", '>' => "\\u003e", '&' => "\\u0026", '\u2028' => "\\u2028", '\u2029' => "\\u2029"}
Characters safe in JSON but unsafe in an HTML breakout, <!-- injection, and mXSS via U+2028/U+2029. Replacements are \uXXXX sequences (valid JSON string escapes). Implements Ruby's ERB::Util.json_escape escaping semantics.
Instance methods
Escape plain text for HTML attribute values / text content (stdlib CGI.escapeHTML equiv).
Escape an already-serialized JSON string for safe embedding inside a .