BOM(1)
π BOM(1) β Decode Unicode byte order mark π
okay bestie, this is the General Commands Manual page for bom, and it's literally here to decode, verify, report, and/or strip the Unicode byte order mark. no cap. β¨
β¨ NAME β¨
bom β Decode Unicode byte order mark.
πΈ SYNOPSIS πΈ
the whole mood board:
bom --strip [--expect types] [--lenient] [--prefer32] [--utf8] [file]
bom --detect [--expect types] [--prefer32] [file]
bom --print type
bom --list
bom --help
bom --version
π DESCRIPTION π
okay so bom decodes, verifies, reports, and/or strips the byte order mark (BOM) at the start of the specified file, if any. That's the whole main character move. π«Ά
When no file is specified, or when file is -, it reads standard input. periodt. π
π OPTIONS π
-d,--detectβ Report the detected BOM type to standard output and then exit. See βSUPPORTED BOM TYPESβ for possible values. π-e,--expecttypes β Expect to find one of the specified BOM types, otherwise exit with an error. Multiple types may be specified, separated by commas. SpecifyingNONEis acceptable and matches when the file has no (supported) BOM. π-h,--helpβ Output command line usage help. π«Ά-l,--lenientβ Silently ignore any illegal byte sequences encountered when converting the remainder of the file to UTF-8. Without this flag,bomwill exit immediately with an error if an illegal byte sequence is encountered. This flag has no effect unless the--utf8flag is given. π--listβ List the supported BOM types and exit. π-p,--printtype β Output the byte sequence corresponding to thetypebyte order mark. π¨οΈ--prefer32β Used to disambiguate the byte sequenceFF FE 00 00, which can be either a UTF-32LE BOM or a UTF-16LE BOM followed by a NUL character. Without this flag, UTF-16LE is assumed; with this flag, UTF-32LE is assumed. π-s,--stripβ Strip the BOM, if any, from the beginning of the file and output the remainder of the file. βοΈ-u,--utf8β Convert the remainder of the file to UTF-8, assuming the character encoding implied by the detected BOM. For files with no (supported) BOM, this flag has no effect and the remainder of the file is copied unmodified. For files with a UTF-8 BOM, the identity transformation is still applied, so (for example) illegal byte sequences will be detected. π-v,--versionβ Output program version and exit. π·οΈ
π¦ SUPPORTED BOM TYPES π¦
the supported BOM types are, in all their glory:
NONEβ No supported BOM was detected.UTF-7β A UTF-7 BOM was detected.UTF-8β A UTF-8 BOM was detected.UTF-16BEβ A UTF-16 (Big Endian) BOM was detected.UTF-16LEβ A UTF-16 (Little Endian) BOM was detected.UTF-32BEβ A UTF-32 (Big Endian) BOM was detected.UTF-32LEβ A UTF-32 (Little Endian) BOM was detected.GB18030β A GB18030 (Chinese National Standard) BOM was detected.
π EXAMPLES π
To tell what kind of byte order mark a file has:
$ bom --detect file
To normalize files with byte order marks into UTF-8, and pass other files through unchanged:
$ bom --strip --utf8 file
Same as previous example, but discard illegal byte sequences instead of generating an error:
$ bom --strip --utf8 --lenient file
To verify a properly encoded UTF-8 or UTF-16 file with a byte-order-mark and output it as UTF-8:
$ bom --strip --utf8 --expect UTF-8,UTF-16LE,UTF-16BE file
To just remove any byte order mark and get on with your life:
$ bom --strip file
β RETURN VALUES β
bom exits with one of the following values:
0β Success.1β A general error occurred.2β The--expectflag was given but the detected BOM did not match.3β An illegal byte sequence was detected (and--lenientwas not specified).
π₯ SEE ALSO π₯
iconv(1)bom: Decode Unicode byte order mark, https://github.com/archiecobbs/bom.- Byte order mark (Wikipedia), https://en.wikipedia.org/wiki/Byte_order_mark.
π AUTHOR π
Archie L. Cobbs β <archie.cobbs@gmail.com> π
xoxo, your Debian bestie π β this page is from Debian, dated October 14, 2021, and it's the BOM(1) manual. slay. π
π¦ where this page comes from
- opensuse-leap 16.0: bom 1.0.1-bp160.1.1 Β· Apache-2.0
- opensuse-leap 16.0: bom 1.0.1-bp160.1.1 Β· Apache-2.0
- opensuse-leap 16.0: bom 1.0.1-bp160.1.1 Β· Apache-2.0
- opensuse-leap 16.0: bom 1.0.1-bp160.1.1 Β· Apache-2.0
- Copyright (C) 2021 Archie L. Cobbs. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms