BOM(1)

πŸ“¦ version 1.0.1, in opensuse-leap 16.0

πŸ’– 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, --expect types β€” Expect to find one of the specified BOM types, otherwise exit with an error. Multiple types may be specified, separated by commas. Specifying NONE is 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, bom will exit immediately with an error if an illegal byte sequence is encountered. This flag has no effect unless the --utf8 flag is given. 😌
  • --list β€” List the supported BOM types and exit. πŸ“‹
  • -p, --print type β€” Output the byte sequence corresponding to the type byte order mark. πŸ–¨οΈ
  • --prefer32 β€” Used to disambiguate the byte sequence FF 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 --expect flag was given but the detected BOM did not match.
  • 3 β€” An illegal byte sequence was detected (and --lenient was not specified).

πŸ”₯ SEE ALSO πŸ”₯

πŸ‘‘ 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