mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
head: handle multibyte numeric utf-8 chars
This commit is contained in:
parent
2d3b8db9ed
commit
ee721ebf4e
2 changed files with 5 additions and 1 deletions
|
@ -20,7 +20,7 @@ pub fn parse_obsolete(src: &str) -> Option<Result<impl Iterator<Item = OsString>
|
|||
let mut has_num = false;
|
||||
let mut last_char = 0 as char;
|
||||
for (n, c) in &mut chars {
|
||||
if c.is_numeric() {
|
||||
if c.is_digit(10) {
|
||||
has_num = true;
|
||||
num_end = n;
|
||||
} else {
|
||||
|
|
|
@ -306,6 +306,10 @@ fn test_head_invalid_num() {
|
|||
));
|
||||
}
|
||||
}
|
||||
new_ucmd!()
|
||||
.args(&["-c", "-³"])
|
||||
.fails()
|
||||
.stderr_is("head: invalid number of bytes: '³'");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue