Simplify URLSearchParams::serialize's percent-encoding.

This commit is contained in:
Ms2ger 2015-03-27 15:35:13 +01:00
parent 5dd43bf84c
commit f45db7714c

View file

@ -135,13 +135,7 @@ impl URLSearchParamsHelpers for URLSearchParams {
// Encode everything else using 'percented-encoded bytes'
// http://url.spec.whatwg.org/#percent-encode
a => {
let mut encoded = vec!(0x25); // %
let s = format!("{}", radix(a, 16)).into_ascii_uppercase();
let bytes = s.as_bytes();
encoded.push_all(bytes);
encoded
}
a => format!("%{:X}", a).into_bytes(),
};
buf.push_all(&append);
}