use std::fmt::Write as _;
pub(crate) fn encode_component(value: &str) -> String {
let mut output = String::new();
for byte in value.bytes() {
if byte.is_ascii_alphanumeric() || matches!(byte, b'-' | b'_' | b'.' | b'~') {
output.push(char::from(byte));
} else {
let _ = write!(output, "%{byte:02X}");
}
}
output
}