(Video materials in preparation)
uriencode : performs URI encoding.
Usage : uriencode <file>
uriencode <field> ... <file>
uriencode num=<n> <file>
uriencode -a <file>
Version : Tue Jan 9 09:02:34 JST 2024
Edition : 1
Read input data from standard input to encode with URI encode defined in
RFC 3986 following the policy designated by arguments.
The data will be encoded with percent-encoding. All characters
except unreserved characters will be encoded. RFC 3986 defines alphabets,
decimals, hyphens, periods, underscores and tildes from ASCII code as it.
In a mode other than the whole encoding mode mentioned later,
'\' is interpreted as an escape character and converted as follows.
\xhhh a hexadecimal (where hhh is hexadecimal of arbitrary length)
\ooo a octal digit (where ooo is octal not longer than 3 digits)
\a an alert (0x07)
\b a backspace (0x08)
\f a form feed (0x0c)
\n a line feed (0x0a)
\r a carriage return (0x0d)
\t a horicontal tab (0x09)
\v a vertical tab (0x0b)
Backslashes following any other character will be ignored.
uriencode reads from the standard input by not giving <file> or
giving "-" as arguments.
Encodes content line-wise by giving <file> as the only argument.
Line feeds are printed intact '\' is interpreted as an escape
character.
$ cat data
a b c d e
あ い\\ う\n え お
か き く け こ
$ uriencode data
a%20b%20c%20d%20e
%E3%81%82%20%E3%81%84%5C%20%E3%81%86%0A%20%E3%81%88%20%E3%81%8A
%E3%81%8B%20%E3%81%8D%20%E3%81%8F%20%E3%81%91%20%E3%81%93
Encodes only specified fields when fields are given.
NF or NF-1 can be used as fields. Subsequent fields can be specified
as 3/5. The fields must be designated in the ascending order.
The whitespaces and line feeds are printed intact. '\' is interpreted
as an escape character.
$ uriencode 1 3 5 data
a b c d e
%E3%81%82 い\\ %E3%81%86%0A え %E3%81%8A
%E3%81%8B き %E3%81%8F け %E3%81%93
By giving num= argument, the heading <n> fields will be printed intact
and only the following fields will be encoded. The line feeds and
whitespaces will not be encoded but printed intact. '\' is interpreted
as an escape character.
$ uriencode num=2 data
a b c%20d%20e
あ い\\ %E3%81%86%0A%20%E3%81%88%20%E3%81%8A
か き %E3%81%8F%20%E3%81%91%20%E3%81%93
By giving -a option the whole file will be encoded including
the whitespace and line feeds. '\' is not interpreted as an escape
character printed in the escaped form.
$ uriencode -a < data
a%20b%20c%20d%20e%0A%E3%81%82%20%E3%81%84%5C%5C%20%E3%81%86%5Cn%20\
%E3%81%88%20%E3%81%8A%0A%E3%81%8B%20%E3%81%8D%20%E3%81%8F%20%E3%81\
%91%20%E3%81%93%0A
(Note: '\' and line feeds will not printed actually).
The command does not occur an error even if trailing line feed is missing
and output does not end with a line feed.