Skip to content

Commit

Permalink
Handled UTF-8 BOM
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankHB committed Jul 25, 2020
1 parent 303db0d commit 65d9eb6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/book/book.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,10 @@ fn load_chapter<P: AsRef<Path>>(
format!("Unable to read \"{}\" ({})", link.name, location.display())
})?;

if content.as_bytes().starts_with(b"\xef\xbb\xbf") {
content = content[3..].to_string()
}

let stripped = location
.strip_prefix(&src_dir)
.expect("Chapters are always inside a book");
Expand Down

0 comments on commit 65d9eb6

Please sign in to comment.