mirror of
https://github.com/sharkdp/fd.git
synced 2024-10-18 06:10:12 +02:00
Fix percent encoding
When the first digit is 0
This commit is contained in:
parent
b1f7aef00b
commit
45d6fbb9e2
@ -39,7 +39,7 @@ fn encode(f: &mut Formatter, byte: u8) -> fmt::Result {
|
|||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
b'\\' => f.write_char('/'),
|
b'\\' => f.write_char('/'),
|
||||||
_ => {
|
_ => {
|
||||||
write!(f, "%{:X}", byte)
|
write!(f, "%{:02X}", byte)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -80,8 +80,8 @@ mod test {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_unicode_encoding() {
|
fn test_unicode_encoding() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Encoded("$*\x1bßé/∫😃").to_string(),
|
Encoded("$*\x1bßé/∫😃\x07").to_string(),
|
||||||
"%24%2A%1B%C3%9F%C3%A9/%E2%88%AB%F0%9F%98%83",
|
"%24%2A%1B%C3%9F%C3%A9/%E2%88%AB%F0%9F%98%83%07",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user