#entity #html-entity #html-escape #html-encode #html-decode

bin+lib htmlentity

Encode a unicode character to html entity, decode html entity to a unicode character

11 releases (stable)

1.2.0 Mar 19, 2021
1.1.3 Mar 18, 2021
1.1.1 Feb 18, 2021
1.1.0 Jan 27, 2021
0.1.2 Nov 30, 2020

#204 in Encoding

Download history 127/week @ 2021-09-26 30/week @ 2021-10-03 145/week @ 2021-10-10 20/week @ 2021-10-17 16/week @ 2021-10-24 21/week @ 2021-10-31 22/week @ 2021-11-07 21/week @ 2021-11-14 20/week @ 2021-11-21 24/week @ 2021-11-28 28/week @ 2021-12-05 39/week @ 2021-12-12 113/week @ 2021-12-19 69/week @ 2021-12-26 33/week @ 2022-01-02 71/week @ 2022-01-09

287 downloads per month
Used in 4 crates (via rphtml)

MIT license

110KB
4.5K SLoC

htmlentity

html entity encode and decode.

Docs Build Status codecov

How to use

use htmlentity::entity::*;

let html = "<div class='header'></div>";
let html_encoded: Vec<char> = encode(html, Entities::SpecialChars, EncodeType::Named);
assert_eq!(html_encoded.iter().collect::<String>(), "&lt;div class=&apos;header&apos;&gt;&lt;/div&gt;");

let html_decoded: Vec<char> = decode_chars(&html_encoded);
assert_eq!(html, html_decoded.iter().collect::<String>());

For more details, please see the document in Docs.rs

License

MIT License.


lib.rs:

htmlentity

A library used for encoding and decoding for html entities.

Dependencies