Skip to main content

escape_html

Function escape_html 

Source
pub fn escape_html(input: &str, buf: &mut dyn Write) -> Result<()>
Expand description

Escape HTML following OWASP

Escape the following characters with HTML entity encoding to prevent switching into any execution context, such as script, style, or event handlers. Using hex entities is recommended in the spec. In addition to the 5 characters significant in XML (&, <, >, “, ’), the forward slash is included as it helps to end an HTML entity.

& --> &amp;
< --> &lt;
> --> &gt;
" --> &quot;
' --> &#39;