What is a BOM?

BOM is an acronym for byte-order-mark. BOM describes the order in which a sequence of bytes is stored in computer memory. The acronym is stored at the beginning of a text file to tell the reading application the order in which the bytes are organized, as big-endian or little-endian. BOM also indicates if a character is stored in 16- or 32-bit UNICODE. And, the BOM is also used to mark UFT-7 and UTF-8 files. These files are 8-bit files that use a code to store 16-bit characters. Therefore, the name BOM for these kinds of files is a bit misleading. While it is convenient to know the file format, a BOM can be used to mark the format inside the file.

If a file is read by an application not aware of BOMs, the system shows the characters used to sign the file as data. In this case, you can use Kaboom to read a file with a BOM and convert the file into a file without a BOM.

2 Comments

  1. Generally using of BOM on Windows machines is good solution. However, using Unicode files with BOM in LAMP (Linux, Apache, MySQL, PHP) environment can cause some troubles. So, for Web sites/applications based on PHP, files without BOM could be better idea.

    Janusz

  2. You are right. Especially if you want to use the header command in PHP, which has to be before any other output, a BOM can mean a nasty bug to track. Your editor will not show the BOM but PHP will complain that the header must be before any other output.

    Markus

Leave a Reply