Example:

Add to .bashrc/.zshrc as an alias:
alias nonprint='perl -pe "use Term::ANSIColor; s/([^[:print:]\n])/colored(sprintf(\"<0x%02x>\", ord($1)), magenta)/ge"'
Use it as a script:
cat << EOF > ~/bin/nonprint && chmod +x ~/bin/nonprint
#!/usr/bin/env perl -p
use Term::ANSIColor;
s/([^[:print:]\n])/colored(sprintf("<0x%02x>", ord()), magenta)/ge
EOF