Sometimes you want to transform a string value into a URL encoded value, so it can be used as part of a valid URL.
For example a string with spaces or special characters can not be used in a URL as is, but needs to be URL encoded.
Nushell has the url encode
command to achieve this.
You can simple run this command on a string value and the result is a URL encoded value.
With the option --all
or -a
even more special characters like a dot (.
) are encoded.
The input of the command can be a string value or a list of string values.
But it is also possible to use a record or table structure, but then you need to add as extra argument the name or names of the keys or columns of which the string values should be encoded.
Oppossed to URL encoding a value you can also decode a URL encoded value using the url decode
command.
This command doesn’t have a special option to run.
Just like with the url encode
command the url decode
command works on strings, list of strings, records and tables.
If the input is a record or table the name of key or column of which the values must be decoded must be passed as extra arguments.