diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/xml/parser.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/xml/parser.rs b/src/xml/parser.rs index 9cdafb1..bc8240c 100644 --- a/src/xml/parser.rs +++ b/src/xml/parser.rs @@ -1,5 +1,6 @@ use std::io::BufRead; +use quick_xml::escape::unescape; use quick_xml::events::attributes::AttrError; use quick_xml::events::{BytesStart, BytesText, Event}; use quick_xml::Reader; @@ -48,7 +49,13 @@ impl<Source: BufRead> Parser<Source> fn parse_text(text: &BytesText) -> Result<String, Error> { - String::from_utf8(text.to_vec()).map_err(|_| Error::TextNotUTF8) + let text_escaped = + String::from_utf8(text.to_vec()).map_err(|_| Error::TextNotUTF8)?; + + let text_unescaped = unescape(&text_escaped) + .map_err(|err| Error::QuickXMLFailed(quick_xml::Error::EscapeError(err)))?; + + Ok(text_unescaped.to_string()) } fn parse_tagged(&mut self, start: &BytesStart) -> Result<Element, Error> |