voca_rs
voca_rs copied to clipboard
Encode/decode URI?
I didn't see anything at a glance, but wanted to check if there's any support to encode/decode URIs with this library. I know some other Rust libraries exist that do this, but I'm already using voca for html escaping and also need URI encoding. Would love to maintain a single dependency instead of multiple if it makes sense.
Example in JavaScript is the encodeURI function.
At the moment, I'm using percent-encoding to achieve this.
Hi @chipsenkbeil! Thank you for using my crate! 😸 I agree; that might be a valuable addition to it. Have you reviewed this crate https://crates.io/crates/pct-str? It's pretty small (9Kb) and does exactly what you want? Does it fit you? Or maybe this one https://crates.io/crates/urlencoding? (5Kb) Otherwise, could you please provide test cases that you are interested in?
@e1r0nd, I'm using percent-encoding right now, which is slightly smaller than pct-str. Both of these along with urlencoding appear to do the same thing, which is good as this shouldn't be too hard. 😄
For me, the specific use case is that I parse documents for links, but these links can also reference local files that have spaces in their paths. I first encode all spaces as %20 (as well as other relevant characters) and then parse using uriparse-rs.
No movements on this, so it is closed.