#byte-stream #ascii-byte #byte #escaping #stream #ascii #programming-language

app escape-ascii

An extremly tiny tool to convert stdin raw byte stream to printable escaped-ascii form (with slice::escape_ascii()), such as byte literals in source codes on many programming languages (e.g. "\x1b\x04printable\x16\n")

1 unstable release

0.1.0 Jun 30, 2023

#279 in Value formatting

MIT license

5KB

Escape ASCII

binary-example-0.png binary-example-1.png

An extremely tiny tool to convert stdin raw byte stream to printable escaped-ascii form, such as byte literals in source codes on many programming languages (e.g. "\x1b\x04printable\x16\n").

This tool just help calling the rust function slice::escape_ascii directly from command line.
For more information about how this tool converts, check the rust official documentations of std::ascii::escape_default.

Install

$ cargo install escape-ascii

Example

  • Get random 10 bytes and convert to escaped-ascii form
$ BYTES="$(cat /dev/urandom | head -c10)"
$ printf "%s" "$BYTES"; echo
��f�YڵH
$ printf "%s" "$BYTES" | escape-ascii; echo
\x8a\x8bf\xa1\x8f\x08Y\xda\xb5H

Author

Kim Hwiwon <kim.hwiwon@outlook.com>

License

The MIT License (MIT)

No runtime deps