diff --git a/components/net/about_loader.rs b/components/net/about_loader.rs index af855d26071..3c74a8dd8de 100644 --- a/components/net/about_loader.rs +++ b/components/net/about_loader.rs @@ -28,7 +28,11 @@ pub fn factory(mut load_data: LoadData, start_chan: Sender) { // FIXME: Find a way to load this without relying on the `../src` directory. let mut path = os::self_exe_path().expect("can't get exe path"); path.pop(); - path.push_many(["src", "test", "html", "failure.html"]); + if !path.join(Path::new("./tests/")).is_dir() { + path.pop(); + } + path.push_many(["tests", "html", "failure.html"]); + assert!(path.exists()); load_data.url = Url::from_file_path(&path).unwrap(); } _ => { 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, 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, }); }