remove utf8 BOM from start of files
This commit is contained in:
parent
6debd2ef52
commit
b771befed4
@ -40,7 +40,7 @@ impl<'a> Iterator for Lexer<'a> {
|
||||
impl<'a> Lexer<'a> {
|
||||
pub fn new(file: &'a Arc<File>) -> Lexer<'a> {
|
||||
Lexer {
|
||||
buf: file.source().chars().peekable(),
|
||||
buf: file.source().trim_start_matches("\u{ef}\u{bb}\u{bf}").trim_start_matches("\u{feff}").chars().peekable(),
|
||||
pos: 0,
|
||||
file,
|
||||
}
|
||||
|
@ -96,3 +96,13 @@ test!(
|
||||
"a {\n a: b\n}\n\nb {}\n",
|
||||
"a {\n a: b;\n}\n"
|
||||
);
|
||||
test!(
|
||||
file_begins_with_utf8_bom,
|
||||
"\u{feff}a {\n color: red\n}\n",
|
||||
"a {\n color: red;\n}\n"
|
||||
);
|
||||
test!(
|
||||
file_begins_with_bom,
|
||||
"\u{ef}\u{bb}\u{bf}a {\n color: red\n}\n",
|
||||
"a {\n color: red;\n}\n"
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user