| Crates.io | urlencode |
| lib.rs | urlencode |
| version | 1.0.1 |
| created_at | 2017-08-11 18:01:29.262817+00 |
| updated_at | 2022-05-21 23:01:10.827238+00 |
| description | A CLI utility for URL-encoding or -decoding strings |
| homepage | |
| repository | https://github.com/dead10ck/urlencode |
| max_upload_size | |
| id | 27235 |
| size | 15,116 |
urlencodeurlencode is a CLI utility for URL-encoding or -decoding strings.
You can give it a positional argument for a single string, or you can pipe input to it from stdin.
$ urlencode 'foo bar'
foo%20bar
$ echo -e "foo bar\nbaz quux" | urlencode
foo%20bar
baz%20quux
You can pass -d or --decode to decode the input.
$ urlencode -d 'foo%20bar'
foo bar
$ echo -e "foo%20bar\nbaz%20quux" | urlencode -d
foo bar
baz quux
Run urlencode --help to see all options.
Since different parts of a URL have different encoding requirements, there are
many encode sets to choose from. See
this documentation page
for an explanation of each. They can be specified with the -e or --encode-set
option:
$ echo 'https://docs.rs/percent-encoding/1.0.0/percent_encoding/index.html' | urlencode -e path
https:%2F%2Fdocs.rs%2Fpercent-encoding%2F1.0.0%2Fpercent_encoding%2Findex.html
$ echo 'https://docs.rs/percent-encoding/1.0.0/percent_encoding/index.html' | urlencode -e userinfo
https%3A%2F%2Fdocs.rs%2Fpercent-encoding%2F1.0.0%2Fpercent_encoding%2Findex.html
----
You can install with Cargo with:
cargo install urlencode