1
0
Fork 0
forked from len0rd/rockbox

unicode: Unify check for UTF-16 BOM

Adds utf16_has_bom function

Change-Id: I67ea474c9cf6ca6e6684351c2f54131164b7903c
This commit is contained in:
Roman Artiukhin 2024-12-11 16:00:55 +02:00
parent 11fbbc7826
commit a23002cd5e
4 changed files with 43 additions and 33 deletions

View file

@ -231,15 +231,14 @@ bool parse_cuesheet(struct cuesheet_file *cue_file, struct cuesheet *cue)
char_enc = CHAR_ENC_UTF_8;
bom_read = BOM_UTF_8_SIZE;
}
else if(!memcmp(line, BOM_UTF_16_LE, BOM_UTF_16_SIZE))
else
{
char_enc = CHAR_ENC_UTF_16_LE;
bom_read = BOM_UTF_16_SIZE;
}
else if(!memcmp(line, BOM_UTF_16_BE, BOM_UTF_16_SIZE))
{
char_enc = CHAR_ENC_UTF_16_BE;
bom_read = BOM_UTF_16_SIZE;
bool le;
if (utf16_has_bom(line, &le))
{
char_enc = le ? CHAR_ENC_UTF_16_LE : CHAR_ENC_UTF_16_BE;
bom_read = BOM_UTF_16_SIZE;
}
}
}