ice icon indicating copy to clipboard operation
ice copied to clipboard

Slice Files Encoded in "UTF-8 with BOM" Cannot be Compiled on Ubuntu

Open InsertCreativityHere opened this issue 8 months ago • 0 comments

BOM stands for Byte-Order-Marker - magic bytes which can appear at the start of UTF encoded files, which identifies which specific UTF encoding is being used (UTF8, UTF32 LE, UTF16 BE, etc.). The Slice compilers have logic for detecting and skipping these BOMs, but only when they're at the beginning of a Slice file, since that's the only place they can validly appear

At the moment, this BOM handling is broken on some Linux platforms (at least Ubuntu, possibly RedHat). This isn't a bug with the Slice compilers though, but with MCPP on these platforms. These MCPPs have a quirk (bug?) which causes them to move BOMs to later in a file, if the first line (right after a BOM) happens to be a comment. When this preprocessed Slice is handed to the Slice compiler, it fails to compile, since the BOM is now in an illegal position (ie. it's not at the very beginning of the file).


The original Slice file (note that the BOM (the little question mark) is at the start of the file)

Image

Compiling this on Ubuntu, the preprocessor spits out this output: (note that the BOM is now after the comment, no longer at the start of the file)

Image

InsertCreativityHere avatar May 05 '25 18:05 InsertCreativityHere