diff options
Diffstat (limited to 'components/script/html/hubbub_html_parser.rs')
-rw-r--r-- | components/script/html/hubbub_html_parser.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/components/script/html/hubbub_html_parser.rs b/components/script/html/hubbub_html_parser.rs index 6862ef4a492..89d817b9380 100644 --- a/components/script/html/hubbub_html_parser.rs +++ b/components/script/html/hubbub_html_parser.rs @@ -20,6 +20,9 @@ use dom::types::*; use html::cssparse::{StylesheetProvenance, UrlProvenance, spawn_css_parser}; use page::Page; +use encoding::all::UTF_8; +use encoding::types::{Encoding, DecodeReplace}; + use hubbub::hubbub; use hubbub::hubbub::{NullNs, HtmlNs, MathMlNs, SvgNs, XLinkNs, XmlNs, XmlNsNs}; use servo_net::resource_task::{Load, LoadData, Payload, Done, ResourceTask, load_whole_resource}; @@ -142,8 +145,9 @@ fn js_script_listener(to_parent: Sender<HtmlDiscoveryMessage>, error!("error loading script {:s}", url.serialize()); } Ok((metadata, bytes)) => { + let decoded = UTF_8.decode(bytes.as_slice(), DecodeReplace).unwrap(); result_vec.push(JSFile { - data: String::from_utf8(bytes).unwrap().to_string(), + data: decoded.to_string(), url: metadata.final_url, }); } |