public static function stringToUtf8(string $string): string
    {
        if (!mb_check_encoding($string, 'UTF-8') || !($string === mb_convert_encoding(mb_convert_encoding($string, 'UTF-32', 'UTF-8'), 'UTF-8', 'UTF-32'))) {

            $string = mb_convert_encoding($string, 'UTF-8');

            if (!mb_check_encoding($string, 'UTF-8')) {
                throw new ConvertException('Can not convert given string to UTF-8');
            }
        }

        return $string;
    }