url decode

For strings.

Converts a percent-encoded web safe string to a string.

Command Type

built-in

Signature

> url decode {flags} ...rest

Flags

  • --binary, -b: Return a binary value, to allow decoding non UTF-8 text.

Parameters

  • ...rest: For a data structure input, url decode strings at the given cell paths.

Input/output types:

input output
string string
string binary
list<string> list<string>
list<string> list<binary>
table table
record record

Examples

Decode a URL with escape characters.

> 'https://example.com/foo%20bar' | url decode
https://example.com/foo bar

Decode multiple URLs with escape characters in list.

> ['https://example.com/foo%20bar' 'https://example.com/a%3Eb' '%E4%B8%AD%E6%96%87%E5%AD%97/eng/12%2034'] | url decode
╭───┬─────────────────────────────╮
│ 0 │ https://example.com/foo bar │
│ 1 │ https://example.com/a>b     │
│ 2 │ 中文字/eng/12 34            │
╰───┴─────────────────────────────╯

Decode a percent-encoded iso-8859-1 string.

> '%A3%20rates' | url decode --binary | decode iso-8859-1
£ rates

Ported from nushell/nushell.github.io. Copyright (c) 2021 Nushell Project. MIT License.