diff --git a/src/utils/number.rs b/src/utils/number.rs index e1727b8..0a3f167 100644 --- a/src/utils/number.rs +++ b/src/utils/number.rs @@ -124,7 +124,7 @@ pub(crate) fn eat_number<I: Iterator<Item = Token>>( fn eat_whole_number<I: Iterator<Item = Token>>(toks: &mut PeekMoreIterator<I>, buf: &mut String) { while let Some(c) = toks.peek() { - if !c.kind.is_numeric() { + if !c.kind.is_ascii_digit() { break; } let tok = toks.next().unwrap(); diff --git a/src/value/parse.rs b/src/value/parse.rs index a4f9216..0aa1252 100644 --- a/src/value/parse.rs +++ b/src/value/parse.rs @@ -682,7 +682,7 @@ impl Value { let unit = if let Some(tok) = toks.peek() { let Token { kind, pos } = *tok; match kind { - 'a'..='z' | 'A'..='Z' | '_' | '\\' => { + 'a'..='z' | 'A'..='Z' | '_' | '\\' | '\u{7f}'..=std::char::MAX => { let u = match eat_ident_no_interpolation(toks, true, pos) { Ok(v) => v, Err(e) => return Some(Err(e)), diff --git a/tests/units.rs b/tests/units.rs index 76c837e..6fbcc6a 100644 --- a/tests/units.rs +++ b/tests/units.rs @@ -84,6 +84,11 @@ test!( "a {\n color: unit(1\\9);\n}\n", "a {\n color: \"\\\\9 \";\n}\n" ); +test!( + non_ascii_numeric_interpreted_as_unit, + "a {\n color: 2߄;\n}\n", + "@charset \"UTF-8\";\na {\n color: 2߄;\n}" +); error!( display_single_mul, "a {\n color: 1rem * 1px;\n}\n", "Error: 1rem*px isn't a valid CSS value."