AutoDetectUnicodeFiles Key

By convention, all UCS-2 encoded files start with a Byte Order Mark (BOM). The BOM is the Unicode character ZERO WIDTH NO-BREAK SPACE that has a hexadecimal value of 0xFEFF. The BOM serves two purposes:

On little-endian architectures such as Intel, the high order byte is written first so the BOM is physically recorded in the file as 0xFFFE. On big-endian architectures, the BOM is recorded as 0xFEFF.

If auto-detection of UCS-2 encoded files is enabled, Production Reporting checks whether the first two bytes of each file that it opens equal either 0xFEFF or 0xFFFE. If so, the file reads as a UCS-2 encoded file.

If an ENCODING directive is specified on an OPEN statement, Production Reporting does not attempt to auto-detect. It uses the encoding specified.

The BOM is not considered part of the file when performing fixed field width file I/O. In other words, reading 2 bytes from a UCS-2 file after it is opened returns the first Unicode character after the BOM, not the BOM itself.

When creating a UCS-2 output file, Production Reporting writes a BOM to the file as the file's first two bytes.