Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

unicodecheck-0.4.1.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

unicodecheck-0.4.1-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file unicodecheck-0.4.1.tar.gz.

File metadata

  • Download URL: unicodecheck-0.4.1.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.0

File hashes

Hashes for unicodecheck-0.4.1.tar.gz
Algorithm Hash digest
SHA256 0517b801a8fc1fbb38bd470693c2c163a03496fff7b43559077f7858738afe25
MD5 f9115ae34ffc01bc992d3e81bffb8023
BLAKE2b-256 980dea78c715201c7a7b05f35a6ea9b8ac354760fb2f0b941d3d0a953b1be12a

See more details on using hashes here.

File details

Details for the file unicodecheck-0.4.1-py3-none-any.whl.

File metadata

File hashes

Hashes for unicodecheck-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d4079d63fe832d40f6ba86d55e4613fa4a5ac8a216acb635a705e33f1ef83807
MD5 6fc7ceacde7e4cd25535bad12c7c0316
BLAKE2b-256 9191677ba473ca3f530ca2b1738031f9fe8ac884debd4e4c9b4ec3f130cec698

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page