UTFCHECK(1)
π UTFCHECK(1) β bestie's guide to checking if ur file is valid UTF-8 or ASCII π
okay so. utfcheck. it's a little user command and honestly? iconic. it peeks at ur file and tells u if it's valid UTF-8 or ASCII. let's get into it π¦
β¨ NAME β¨
utfcheck β check a file to verify that it is valid UTF-8 or ASCII π
β¨ SYNOPSIS β¨
utfcheck [-a] [-q] [--expurgated] [-i input_file.beta] [-o output_file.utf8]
β¨ DESCRIPTION β¨
so utfcheck(1) reads an input file and prints out messages about stuff in there that might be unexpected β even if it's legal Unicode, bestie β like embedded control characters or Unicode "noncharacters". π³
no cap: no diagnostic messages get printed for the control characters horizontal tab, vertical tab, line feed, or form feed. those ones are chill.
then a final summary will tell u if null, carriage return, or escape characters were read. π
and here's the dramatic part: utfcheck will detect a UTF-16 big-endian or little-endian Byte Order Mark at the beginning of a file and quit if it sees one. there is no support for parsing UTF-16 files beyond that initial detection of the Byte Order Mark. it's giving "i saw it, i'm out" π
β¨ OPTIONS β¨
-aβ test for a pure ASCII file. ASCII control characters are allowed, bututfcheckwill fail if it encounters a byte with value greater than hexadecimal7F(the delete control character).-iβ specify the input file. the default isSTDIN.-oβ specify the output file. the default isSTDOUT.-qβ quiet mode. do not print any output unless an illegal byte sequence is detected. π€«--expurgatedβ check a UTF-8 file against the "expurgated" version of the Unicode Standard, the one without the Byte Order Mark, after Monty Python's "Bookshop" skit with the "expurgated" version of Olsen's Standard Book of British Birds, the one without the gannetβbecause the customer didn't like them. (But they've all got the Byte Order Mark. It's a standard part of the Unicode Standard, the Byte Order Mark. It's in all the books.) This option is not abbreviated, to keep the user mindful of the questionable nature of testing for the lack of something even though it is a legitimate part of the Unicode Standard.utfcheckwill fail if this option is selected and the UTF-8 Byte Order Mark (officially the zero width no-break space) is detected anywhere in the input file.
Sample usage:
utfcheck -i my_input_file.txt -o my_output_file.log
β¨ MESSAGES β¨
π«Ά IMMEDIATE MESSAGES
Some uncommon characters are noted immediately as they are encountered. Some are fatal errors and some are not, as noted below. The messages associated with them follow.
ASCII-CONTROL: U+nnnn
The file contains ASCII control characters in the range U+0001 through U+001F, inclusive, except for Horizontal Tab, Line Feed, Vertical Tab, Form Feed, New Line, Carriage Return; or the file contains the Delete character (U+007F).
ASCII-NULL
The file contains an ASCII NULL character (U+0000).
BINARY-DATA: 0xnn
The file contains a byte value that is not part of a well-formed UTF-8 character. This is considered a fatal error and the program will terminate with exit status EXIT_FAILURE. π
NON-ASCII-DATA: 0xnn
The -a (ASCII only) option was selected and the file contains non-ASCII data (i.e., a byte with the high bit set). This is considered a fatal error and the program will terminate with exit status EXIT_FAILURE.
SURROGATE-PAIR-CODE-POINT: 0xnn... (U+nnnn)
The file contains a Unicode surrogate pair code point encoded as UTF-8 (U+D800 through U+DFFF, inclusive). Surrogate code points are used with UTF-16 files, so they should never appear in UTF-8 files. The byte values are printed first, and then the UTF-8 converted Unicode code point is printed in parentheses. This is considered a fatal error and the program will terminate with exit status EXIT_FAILURE.
UTF-16-BE: Unsupported
The file begins with a big-endian UTF-16 Byte Order Mark. Because utfcheck does not support UTF-16, this is considered a fatal error and the program will terminate with exit status EXIT_FAILURE.
UTF-16-LE: Unsupported
The file begins with a little-endian UTF-16 Byte Order Mark. Because utfcheck does not support UTF-16, this is considered a fatal error and the program will terminate with exit status EXIT_FAILURE.
UTF-8-BOM-BEGIN
The file begins with a Byte Order Mark (U+FEFF) in UTF-8 form. If the --expurgated option is selected and this condition is detected, this is considered a fatal error and the program will terminate with exit status EXIT_FAILURE; otherwise, the program continues.
UTF-8-BOM-EMBEDDED
The file contains a Byte Order Mark (U+FEFF) after the start of the file. If the --expurgated option is selected and this condition is detected, this is considered a fatal error and the program will terminate with exit status EXIT_FAILURE; otherwise, the program continues.
UTF-8-CONTROL: 0xnn... (U+nnnn)
The file contains a UTF-8 control character (U+0080 through U+009F, inclusive). The byte values are printed first, and then the UTF-8 converted Unicode code point is printed in parentheses.
UTF-8-NONCHARACTER: 0xnn... (U+nnnn)
The file contains a Unicode "noncharacter". This can be a code point in the range U+FDD0 through U+FDEF, inclusive, or the last two code points of any Unicode plane, from Plane 0 through Plane 16, inclusive. The byte values are printed first, and then the UTF-8 converted Unicode code point is printed in parentheses. Note that a noncharacter is allowable in well-formed Unicode files, so this condition is not considered an error. (so like. it's fine. it's giving "weird but legal" π
)
πΈ END OF FILE SUMMARY
If the -q option is not selected and the program has not encountered a fatal error before reaching the end of the input stream, utfcheck prints a summary of the file contents after the input stream has reached its end. This will begin with the line "FILE-SUMMARY:". This is followed by a line beginning with "Character-Set: " followed by one of "ASCII", "UTF-8", "UTF-16-BE" (UTF-16 Big Endian), "UTF-16-LE" (UTF-16 Little Endian), or "BINARY". (Note that UTF-16 parsing is not currently implemented, so the UTF-16-BE and UTF-16-LE types will not appear in this final summary at present.) The following messages can appear in this end of file summary if the program encountered the corresponding types of Unicode code points.
BOM-AT-STARTβ The file begins with a UTF-8 Byte Order Mark (U+FEFF).BOM-AFTER-STARTβ The file contains a UTF-8 Byte Order Mark (U+FEFF) after the start of the file.CONTAINS-NULLSβ The file contains null characters (U+0000).CONTAINS-CARRIAGE_RETURNβ The file contains carriage returns (U+000D).CONTAINS-CONTROL_CHARACTERSβ The file contains ASCII control characters in the rangeU+0001throughU+001F, inclusive, except for Horizontal Tab, Line Feed, Vertical Tab, Form Feed, New Line, or Carriage Return; or contains the Delete character (U+007F) or control characters in the rangeU+0080throughU+009F, inclusive.CONTAINS-ESCAPE_SEQUENCESβ The file contains at least one ASCII escape character (U+001B), which is interpreted to be part of an escape sequence (for example, a VT-100 or ANSI terminal control sequence).Plane-0-PUA: n charactersβ Number of Plane 0 Private Use Area characters in file.Plane-15-PUA: n charactersβ Number of Plane 15 Private Use Area characters in file.Plane-16-PUA: n charactersβ Number of Plane 16 Private Use Area characters in file.
β¨ EXIT STATUS β¨
utfcheck will exit with a status of EXIT_SUCCESS if the input file only contains valid text, or with a status of EXIT_FAILURE if it contains invalid bytes. that's the whole vibe check right there π
β¨ FILES β¨
ASCII or UTF-8 text files. that's it. that's the list. π
β¨ AUTHOR β¨
utfcheck was written by Paul Hardy. π ty king
β¨ LICENSE β¨
utfcheck is Copyright Β© 2018 Paul Hardy.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
β¨ BUGS β¨
No known bugs exist. not a single one. flawless behaviour, no notes, ate and left no crumbs π β¨
okay that's literally the whole page bestie, hope u understood the assignment π¦ this was utfcheck, from the UTFCHECK manual, dated 2018 Sep 01 β stay valid out there, mwah π
π¦ where this page comes from
- debian bookworm: utfcheck 1.2-3 Β· GPL-2.0-or-later
- debian trixie: utfcheck 1.2-3 Β· GPL-2.0-or-later
- ubuntu jammy: utfcheck 1.2-3 Β· GPL-2.0-or-later
- ubuntu noble: utfcheck 1.2-3 Β· GPL-2.0-or-later
- ubuntu questing: utfcheck 1.2-3
- ubuntu resolute: utfcheck 1.2-5 Β· GPL-2.0-or-later
- ubuntu stonking: utfcheck 1.2-5 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms