nanohtml2text

Lightweight html to text converter in Rust
git clone git://git.alexwennerberg.com/nanohtml2text
Log | Files | Refs | README | LICENSE

commit 72f8d618676826b46cf4deba8ab808378595ec01
parent 39d3f5d6a5457ed5efd95bbee1fe61f9ed120fcb
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Thu,  6 Jan 2022 08:54:59 -0800

fix html entity parsing

Diffstat:
Msrc/main.rs | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main.rs b/src/main.rs @@ -74,9 +74,9 @@ fn parse_html_entity(ent_name: &str) -> Option<char> { if lower.starts_with("#") && lower.len() > 1 { let parsed; if lower.as_bytes()[1] == b'x' && lower.len() > 2 { - parsed = lower[2..].parse().ok(); + parsed = u32::from_str_radix(&lower[2..], 16).ok(); } else { - parsed = lower[1..].parse().ok(); + parsed = u32::from_str_radix(&lower[1..], 10).ok(); } return parsed.and_then(|n| { if n == 9 || n == 10 || n == 13 || n > 32 {