diff --git a/rust/hg-core/src/requirements.rs b/rust/hg-core/src/requirements.rs --- a/rust/hg-core/src/requirements.rs +++ b/rust/hg-core/src/requirements.rs @@ -24,7 +24,7 @@ .map(|line| { // Python uses Unicode `str.isalnum` but feature names are all // ASCII - if line[0].is_ascii_alphanumeric() { + if line[0].is_ascii_alphanumeric() && line.is_ascii() { Ok(String::from_utf8(line.into()).unwrap()) } else { Err(()) diff --git a/tests/test-rhg.t b/tests/test-rhg.t --- a/tests/test-rhg.t +++ b/tests/test-rhg.t @@ -140,3 +140,8 @@ sparserevlog store indoor-pool + + $ echo -e '\xFF' >> .hg/requires + $ rhg debugrequirements + abort: .hg/requires is corrupted + [255]