nospc is a utility to detect and highlight non-ASCII whitespace characters in text files. It supports highlighting using either colored text or enclosing characters in brackets with Unicode character information.
- Detects non-ASCII whitespace characters
- Supports multiple input files and directories
- Supports standard input
- Highlighting methods:
- Colored text
- Enclosing characters in brackets with Unicode information
- Recursive directory processing
- Python 3.x
termcolor
library
- Clone the repository or download the script.
- Install the required library:
pip install termcolor
To run nospc with a single file:
python nospc.py <filename>
To run nospc with multiple files:
python nospc.py <filename1> <filename2> ...
To run nospc with standard input:
cat somefile.txt | python nospc.py -
To run nospc and process directories recursively:
python nospc.py -r <directory>
You can choose between two highlighting methods: color and brackets. By default, if the output is a TTY, color highlighting is enabled. If the output is not a TTY, bracket highlighting is enabled.
To enable color highlighting:
python nospc.py -c <filename>
To enable bracket highlighting:
python nospc.py -b <filename>
To enable both color and bracket highlighting:
python nospc.py -c -b <filename>
python nospc.py -c file.txt
python nospc.py -b file.txt
python nospc.py -r -c -b directory_name