Skip to main content

escape

Function escape 

Source
pub fn escape<'a>(raw: impl Into<Cow<'a, str>>) -> Cow<'a, str>
Expand description

Escapes an &str and replaces all xml special characters (<, >, &, ', ") with their corresponding xml escaped value. Also escapes \r which would otherwise be converted to \n by XML end-of-line normalization.

This function performs following replacements:

CharacterReplacement
<&lt;
>&gt;
&&amp;
'&apos;
"&quot;
\r&#13;