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