#pragma once

#include <stdint.h>

#include <SDL3/SDL_assert.h>
#include <SDL3/SDL_log.h>

struct crText
{
    static bool HasUtf8Bom( const char* text, const char* name, int32_t logCategory )
    {
        if( ( static_cast< unsigned char >( text[ 0 ] ) != 0xEF ) ||
            ( static_cast< unsigned char >( text[ 1 ] ) != 0xBB ) ||
            ( static_cast< unsigned char >( text[ 2 ] ) != 0xBF ) )
        {
            return false;
        }

        SDL_LogError( logCategory, "crText: %s starts with a UTF-8 BOM — text assets must be plain UTF-8, no BOM", name );
        SDL_assert( false );
        return true;
    }
};
