Skip to main content

escape_attribute

Function escape_attribute 

Source
pub fn escape_attribute(value: &str) -> String
Expand description

Escapes a value for a double-quoted HTML attribute.

This matches PHP’s htmlspecialchars($value, ENT_QUOTES|ENT_SUBSTITUTE): &, <, >, ", and ' become &amp;, &lt;, &gt;, &quot;, and &#039;. No other character changes, and & is escaped first so that an existing entity is not rewritten twice.