Character encoding is annoying but necessary. Here's code for standardized byte order marks (BOM)

const unsigned char enc_utf8[]   = { 0xEF, 0xBB, 0xBF } // UTF-8
const unsigned char enc_utf16L[] = { 0xFF, 0xFE } // UTF-16 Little Endian
const unsigned char enc_utf16B[] = { 0xFE, 0xFF } // UTF-16 Big Endian
const unsigned char enc_utf32L[] = { 0xFF, 0xFE, 0x00, 0x00 } // UTF-32 Little Endian
const unsigned char enc_utf32B[] = { 0x00, 0x00, 0xFE, 0xFF } // UTF-32 Big Endian

This is mostly here for me so I don't have to write it again, but for additional reading, I got these definitions here. Good luck.