A command-line tool for detecting and converting text file encodings.
- Detects encoding of text files (e.g., UTF-8, Shift-JIS, EUC-JP)
- CLI interface for quick checks
- Python API for integration
see docs/ENCODING_DETECTION_STRATEGY.md
pycheck-encoding <filename>$ pycheck-encoding --help
Usage: pycheck-encoding [OPTIONS] [FILE_PATH]
This script provides a simple command-line tool to detect the text
encoding of a given file. It attempts to decode the file's binary
contents using a list of common encodings including UTF-8, UTF-16,
UTF-32, Shift_JIS, EUC-JP, ISO-8859 variants, CP932, and others.
If the file can be successfully decoded with one of these encodings, the
script reports the detected encoding. If none of the encodings work, it
notifies the user that the encoding could not be determined.
╭─ Arguments ─────────────────────────────────────────────────────────────╮
│ file_path [FILE_PATH] Path to the file to check encoding. │
╰─────────────────────────────────────────────────────────────────────────╯
╭─ Options ───────────────────────────────────────────────────────────────╮
│ --version -v Show version information and exit. │
│ --help Show this message and exit. │
╰─────────────────────────────────────────────────────────────────────────╯from encoding_checker_cli.encoding import detect_encoding
encoding = detect_encoding("sample.txt")
print(f"Detected encoding: {encoding}")uv tool install git+https://github.com/RyoNakagami/encoding-checker-cliRun all tests with pytest:
pytestSee docs/TEST_STRATEGY.md for details.
MIT License