[−][src]Function htmlentity::entity::encode
pub fn encode(
content: &str,
entity_set: EntitySet,
encode_type: EncodeType
) -> String
Encode a html code's characters into entities.
Examples
use htmlentity::entity::*; let html = "<div class='header'></div>"; let html_encoded = encode(html, EntitySet::SpecialChars, EncodeType::Named); assert_eq!(html_encoded, "<div class='header'></div>"); let html_decoded = decode(&html_encoded); assert_eq!(html, html_decoded);