UnicodeFix normalizes problematic Unicode artifacts into clean ASCII equivalents.
This project was created to address the increasing frequency of invisible and typographic Unicode characters causing issues in code, configuration files, AI detection, and document processing.
This is an early release. Further polishing and enhancements will follow.
Clone the repository and run the setup script:
git clone https://github.com/unixwzrd/UnicodeFix.git
cd UnicodeFix
bash setup.sh
The `setup.sh` script:
- Creates a dedicated Python virtual environment
- Installs required dependencies
- Adds startup configuration to your `.bashrc` for easier usage
You can review setup.sh to see exactly what is modified.
I also maintain a broader toolset for virtual environment management here: VenvUtil, which may be of interest for more advanced users.
Once installed and activated:
(python-3.10-PA-dev) [unixwzrd@xanax: UnicodeFix]$ python bin/cleanup-text.py --help
usage: cleanup-text.py [-h] [infile ...]
Clean Unicode quirks from text.
positional arguments:
infile Input file(s)
options:
-h, --help Show this help message and exit
UnicodeFix can operate as a standard UNIX pipe:
cat file.txt | cleanup-text > cleaned.txt
If no input file arguments are given, it automatically reads from standard input and writes to standard output.
You can run UnicodeFix as a filter within vi/vim/macvim:
:%!cleanup-text
This command rewrites the entire buffer with cleaned text.
Note:
- Ensure your virtual environment is activated before launching your editor, or
- Use a shell wrapper that sources your `.bashrc` and activates the environment automatically.
Depending on how you manage virtual environments, you may need to adjust your editor’s shell invocation settings.
UnicodeFix includes a macOS Shortcut for direct Finder integration.
You can right-click one or more files and select a Quick Action to clean Unicode quirks without opening a terminal.
-
Open the Shortcuts app.
-
Navigate to `File -> Import`.
-
Select the Shortcut file located in `macOS/Strip Unicode.shortcut`.
-
Edit the Shortcut to point to your local installation of `cleanup-text.py`.
-
You may need to relaunch Finder (`Command+Option+Esc` → Select Finder → Relaunch).
-
After setup, right-click selected files, choose `Quick Actions`, and select `Strip Unicode`.
- bin/cleanup-text.py — Main cleaning script
- bin/cleanup-text — Symlink for command-line usage
- setup.sh — Virtual environment setup script
- requirements.txt — Python dependencies
- macOS/ — macOS Shortcut for Finder integration
- data/ — Example test files with Unicode artifacts
- docs/ — Documentation and screenshots
- LICENSE — License information
- README.md — This file
Feedback, testing, bug reports, and pull requests are welcome.
If you find a better integration path for Linux or Windows platforms, feel free to open an issue or contribute a patch.
If you find UnicodeFix or my other projects valuable, please consider supporting continued development:
Thank you for your support.
- Fixed behavior when processing STDIN pipes
- Added trailing whitespace and blank line normalization
- Added shell script wrapper for easier activation from editors
- Initial release
Copyright 2025
[email protected]
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.