@ 260802.2

220904.1 · 3e922d532232ccb78f0b9b8d9a4387919466bda8

bin/rust: add 'find-invalid-utf8' program

I periodically like to look for files that contain invalid UTF-8, but have poor tooling to do it. Both 'iconv' and to an extent ripgrep can do it, but this program does it exactly how I want to do it: look at all files line by line, and print lines containing invalid UTF-8. And crucially, print invalid UTF-8 bytes as hexadecimal and colorize them.

reading declarations

Changes to bin/rust/find-invalid-utf8/Cargo.toml. All files

bin/rust/find-invalid-utf8/Cargo.toml

new file mode 100644@@ -0,0 +1,16 @@+[package]+name = "find-invalid-utf8"+version = "0.1.0"+edition = "2021"++# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html++[dependencies]+anyhow = "1.0.63"+bstr = "1.0.0-pre.3"+termcolor = "1.1.3"+walkdir = "2.3.2"++[[bin]]+name = "find-invalid-utf8"+path = "main.rs"