#urlencode #url #encode #decode #percent

app urlencode

A CLI utility for URL-encoding or -decoding strings

3 releases

0.1.2 May 7, 2019
0.1.1 Feb 12, 2018
0.1.0 Aug 11, 2017

#5 in #percent

Download history 7/week @ 2021-08-10 4/week @ 2021-08-17 8/week @ 2021-08-24 2/week @ 2021-08-31 3/week @ 2021-09-07 4/week @ 2021-09-14 4/week @ 2021-09-21 3/week @ 2021-09-28 3/week @ 2021-10-05 5/week @ 2021-10-12 4/week @ 2021-10-19 4/week @ 2021-10-26 13/week @ 2021-11-02 6/week @ 2021-11-09 15/week @ 2021-11-16 20/week @ 2021-11-23

54 downloads per month

MIT license

8KB
142 lines

= urlencode

urlencode is a CLI utility for URL-encoding or -decoding strings.

== Usage

You can give it a positional argument for a single string, or you can pipe input to it from stdin.

[source,bash]

$ 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.

[source,bash]

$ 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.

=== Encode sets

Since different parts of a URL have different encoding requirements, there are many encode sets to choose from. See https://docs.rs/percent-encoding/1.0.0/percent_encoding/index.html[this documentation page] for an explanation of each. They can be specified with the -e or --encode-set option:

[source,bash]

$ 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

== Installation

=== Cargo

You can install with Cargo with:

[source,bash]

$ cargo install urlencode

Dependencies

~1MB
~13K SLoC