1 comments

  • ancos2505 10 hours ago ago

    I often found it surprisingly difficult to find a straightforward, lightweight tool just to clean up non-ASCII characters from code and text files without pulling in a heavy chain of dependencies. To solve this, I built `ascii-cleaner`.

    It is a CLI tool written entirely in Rust using only the standard library (zero external crates). I also made a point to write 100% of the code myself as an exercise in relying strictly on core capabilities.

    It has three main actions:

    - `detect`: Scans and logs the presence of non-ASCII characters.

    - `remove`: Strips the characters out entirely.

    - `replace`: Swaps them out (defaults to `?`, but accepts custom replacements via `--char`).

    To prevent accidental data loss, it creates a backup of the target file by default before modifying it, though you can bypass this with a `--no-backup` flag. I also added a `--log-mode` option for large files, which prints a report item for each finding as it scans.

    Feel free to give your thoughts, feedback on the tool behavior, or any edge cases in text encoding you think I should handle.

    Repo: https://github.com/ancos2505/ascii-cleaner