Skip to main content

A CLI tool to convert files (.cpp, .h, etc.) to UTF-8 encoding.

Project description

PyPI version

utf8convert

A command-line utility to recursively convert source files to UTF-8 encoding.

Supports:

  • .cpp, .h, .hpp files by default
  • Any custom extensions via --extensions
  • Logging and summary reports (JSON and terminal)
  • Dry-run mode
  • Default and user-defined subdirectory exclusions

📦 GitHub

Project repository: https://github.com/yhbyhb/utf8convert


🚀 Installation

You can install the package locally after downloading or cloning the repo:

pip install .

This will install the executable command: utf8convert


💻 Usage

utf8convert [DIRECTORY] [OPTIONS]

Options:

  • --dry-run
    Preview files to convert without making changes.

  • --extensions [.ext1 .ext2 ...]
    List of file extensions to process (default: .cpp .h .hpp).

  • --exclude-dirs [dir1 dir2 ...]
    Relative paths of subdirectories to skip.
    Defaults: .git, .vs, vcpkg_installed, and any dot-prefixed folders.

  • --json-output PATH
    Write a summary report as JSON to the specified path.


📌 Examples

🔍 Dry-run all C++ headers and sources

utf8convert ./src --dry-run

🛠 Convert files with .c and .cc extensions too

utf8convert ./src --extensions .cpp .h .hpp .c .cc

🧾 Generate a JSON report

utf8convert ./mycode --json-output utf8_summary.json

🚫 Skip specific folders

utf8convert ./codebase --exclude-dirs build third_party .cache

🧪 Test Locally

hatch run python -m utf8convert.cli ./your/code --dry-run

Let me know if you want to contribute or need help automating PyPI publishing.

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

utf8convert-0.1.2.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

utf8convert-0.1.2-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file utf8convert-0.1.2.tar.gz.

File metadata

  • Download URL: utf8convert-0.1.2.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for utf8convert-0.1.2.tar.gz
Algorithm Hash digest
SHA256 ce9eed4ffc6c8a35f042e7c35ea9b1c884d380fd8bd720bc09c2ab2ad8b56027
MD5 8300b8444a1dac7dd50fc02e587a1738
BLAKE2b-256 0a55a4bfde73d066afca479b90993ab941d1de82d775bb2904dabddc77ba6016

See more details on using hashes here.

File details

Details for the file utf8convert-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: utf8convert-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for utf8convert-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a6b97cfdc8673f07ae203537ff83b68148f530407d0af14a31ae6fb3d9021e35
MD5 01bb44bb159b4c8e0040bf1a81438b43
BLAKE2b-256 7ba51edcfc70f9b2e85eafb99ea3902cd5d1de4389a6a7a7c53c72b5669a5e40

See more details on using hashes here.

Supported by

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