Check if Unicode text files are Unicode-normalized
Project description
Unicodecheck
Simple tool to check if Unicode text files are Unicode-normalized
Install
pip3 install unicodecheck
Usage
Quickstart
unicodecheck -iv SPAM.txt
To check files in a directory recursively:
unicodecheck -ivr Ham/Eggs/
Synopsis
The main program can be invoked either through the unicodecheck
command or through the Python main module option python3 -m unicodecheck
.
usage: unicodecheck [-h] [-V] [-m {NFC,NFD,NFKC,NFKD}] [-d] [-u [NUMBER]] [-r] [-i] [-v]
PATH [PATH ...]
positional arguments:
PATH describe input file or directory (pass '-' to specify stdin)
options:
-h, --help show this help message and exit
-V, --version show program's version number and exit
-m {NFC,NFD,NFKC,NFKD}, --mode {NFC,NFD,NFKC,NFKD}
target Unicode normalization (default: NFC)
-d, --diff show diffs between the original and normalized (default: False)
-u [NUMBER], -U [NUMBER], --unified [NUMBER]
show unified diffs with NUMBER lines of context [NUMBER=3] (default: False)
-r, --recursive follow the directory tree rooted in each PATH argument (default: False)
-i, --include-hidden include hidden files and directories (default: False)
-v, --verbose report non-essential logs (default: False)
Tips
Check whether filenames are normalized
convmv
command is suitable.
NFC
convmv -f utf8 -t utf8 --nfc -r ./
NFD
convmv -f utf8 -t utf8 --nfd -r ./
Notes
- This tool doesn't provide auto in-place (write) file normalization because Unicode normalization doesn't guarantee content equivalence.
- The procedure for determining the binary file refers to Git's algorithm.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
unicodecheck-1.0.2.tar.gz
(7.7 kB
view details)
Built Distribution
File details
Details for the file unicodecheck-1.0.2.tar.gz
.
File metadata
- Download URL: unicodecheck-1.0.2.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95ee7e70809e90be6b4ad527cc428819e8860fe78d18a70d37d2f3ec300543ef |
|
MD5 | 10401739ab04a5e8b7ff7956f9185874 |
|
BLAKE2b-256 | 2217f0766ca9efb33cf8efe89d4f7946dcaaead0f4fd4de06fc4283eca0263a5 |
File details
Details for the file unicodecheck-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: unicodecheck-1.0.2-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 015f1cbb031ccb775407817f92876d6f72047a8e293be1765583d09b087d2158 |
|
MD5 | 74cbdde47137a157bdc0f5b8a3099b7c |
|
BLAKE2b-256 | 331ea7cf172bf8f92eb9d843f381c0a357a4948f3092ade0d3d3c3bec75be625 |