Function htmlescape::decode_html [] [src]

pub fn decode_html(s: &str) -> Result<String, DecodeErr>

Decodes an entity-encoded string.

Decodes an entity encoded string, replacing HTML entities (&amp;, &#20; ...) with the the corresponding character. Case matters for named entities, ie. &Amp; is invalid. Case does not matter for hex entities, so &#x2E; and &#x2e; are treated the same.


  • s - Entity-encoded string to decode.


The function will fail if input string contains invalid named entities (eg. &nosuchentity;), invalid hex entities (eg. &#xRT;), invalid decimal entities (eg. &#-1;), unclosed entities (s == "&amp hej och hå"`) or otherwise malformed entities.

This function will never return errors with kind set to IoError or EncodingError.