Skip to main content

unescape

Function unescape 

Source
pub fn unescape(s: &str) -> Cow<'_, str>
Expand description

Expand the five XML predefined entity references (&amp;, &lt;, &gt;, &quot;, &apos;) and numeric character references (&#NN;, &#xNN;) inside s. Intended for callers using ParseOptions::skip_entity_expansion who want to decode a specific text payload on demand.

Returns Cow::Borrowed(s) when s contains no & — i.e. the no-entity case is zero-copy.

General entities declared in a DTD (<!ENTITY foo "...">) are not expanded here; the helper has no access to the document’s entity table. If you need DTD-defined entity expansion, don’t enable skip_entity_expansion in the first place.