W3cubDocs

/Nushell

decode for strings

Decode bytes into a string.

Signature

> decode {flags} (encoding)

Parameters

  • encoding: the text encoding to use

Input/output types:

input output
binary string

Examples

Decode the output of an external command

> ^catmyfile.q|decodeutf-8

Decode an UTF-16 string into nushell UTF-8 string

>0x[0053006F006D006500200044006100740061] |decodeutf-16be
SomeData

Notes

Multiple encodings are supported; here are a few: big5, euc-jp, euc-kr, gbk, iso-8859-1, utf-16, cp1252, latin5

For a more complete list of encodings please refer to the encoding_rs documentation link at https://docs.rs/encoding_rs/latest/encoding_rs/#statics

Subcommands:

name type usage
decode base64 Builtin Base64 decode a value.
decode hex Builtin Hex decode a value.

Copyright © 2019–2023 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/decode.html