Skip to content

Commit

Permalink
Handled UTF-8 BOM
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankHB authored and notriddle committed Dec 23, 2021
1 parent 9f49325 commit 9346ee5
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 9346ee5

Please sign in to comment.