Skip to content
/ safe_ascii Public

A CLI tool for sanitising input to printable ASCII characters.

License

Notifications You must be signed in to change notification settings

YC/safe_ascii

Folders and files

NameName
Last commit message
Last commit date

Latest commit

d64ac95 · Feb 21, 2025

History

87 Commits
Oct 2, 2023
Dec 3, 2023
Feb 21, 2025
Aug 7, 2022
Aug 7, 2022
Jul 6, 2021
Feb 21, 2025
Feb 21, 2025
Aug 9, 2022
Dec 3, 2023

Repository files navigation

safe_ascii

A tool for sanitising input to printable ASCII characters.

Used for marking programming assignments, where the output may contain unexpected binary characters which taint the test execution output.

Usage

Usage: safe-ascii [OPTIONS] [files]...

Arguments:
  [files]...
          A list of files to process.
          Use '-' for stdin.

Options:
  -m, --mode <mnemonic|escape|suppress>
          Mode of character conversion/suppression.

          [default: mnemonic]

          Possible values:
          - mnemonic: Abbreviation, e.g. (NUL), (SP), (NL)
          - escape:   Hex sequence, e.g. \x00, \x20, \x0a
          - suppress: Suppress non-printable characters

  -t, --truncate <truncate-length>
          Length (bytes) to truncate at, -1 represents no truncation.

          [default: -1]

  -x, --exclude <exclude-characters>
          Comma-delimited decimal values of characters to print.
          (9 is HT (tab), 10 is NL (newline), 13 is CR (carriage return), 32 is SP (space))

          [default: 10,32]

Example

$ safe-ascii -x 10 Cargo.toml
[package]
name(SP)=(SP)"safe-ascii"
version(SP)=(SP)"1.0.0"
...