41 lines
681 B
Markdown
41 lines
681 B
Markdown
|
# valid-utf8 — Filter tool to check whether text is valid UTF-8 or not
|
||
|
|
||
|
If no file argument is given, valid-utf8 reads from standard input.
|
||
|
|
||
|
## Build
|
||
|
|
||
|
`make`
|
||
|
|
||
|
after building and installing dependencies:
|
||
|
|
||
|
- [libscstring](https://git.bobpolis.com/bob/libscstring/)
|
||
|
|
||
|
## Install
|
||
|
|
||
|
`sudo make install`
|
||
|
|
||
|
or, on OpenBSD:
|
||
|
|
||
|
`doas gmake install`
|
||
|
|
||
|
## Run
|
||
|
|
||
|
Test a file:
|
||
|
|
||
|
`valid-utf8 <file>`
|
||
|
|
||
|
No output, but exit status will be 0 on success, but 1 if file is not valid
|
||
|
UTF8.
|
||
|
|
||
|
Use a a filter:
|
||
|
|
||
|
`echo "some text" | valid-utf8`
|
||
|
|
||
|
Again, only exit status will indicate validity.
|
||
|
|
||
|
Find all valid UTF8 files in the current directory, and all directories under
|
||
|
it:
|
||
|
|
||
|
`find . -exec valid-utf8 "{}" \;`
|
||
|
|