Add cast to unsigned char when checking for UTF-8 BOM