Skip to content

Commit

Permalink
Fix percent encoding
Browse files Browse the repository at this point in the history
When the first digit is 0
  • Loading branch information
tmccombs committed Jun 24, 2024
1 parent b1f7aef commit 45d6fbb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/hyperlink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand Down Expand Up @@ -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",
);
}
}

0 comments on commit 45d6fbb

Please sign in to comment.