input: skip BOM properly

Key names are already required be UTF-8 like everything else
in mpv other than media file formats which support other encodings.
stream_skip_bom is the wrong function for this, since it also skips
UTF-16 BOM.
This commit is contained in:
nanahi 2024-09-20 03:32:54 -04:00 committed by Kacper Michajłow
parent b08cab7a6c
commit 3863221246
1 changed files with 1 additions and 1 deletions

View File

@ -1478,10 +1478,10 @@ static bool parse_config_file(struct input_ctx *ictx, char *file)
MP_ERR(ictx, "Can't open input config file %s.\n", file); MP_ERR(ictx, "Can't open input config file %s.\n", file);
goto done; goto done;
} }
stream_skip_bom(s);
bstr data = stream_read_complete(s, tmp, 1000000); bstr data = stream_read_complete(s, tmp, 1000000);
if (data.start) { if (data.start) {
MP_VERBOSE(ictx, "Parsing input config file %s\n", file); MP_VERBOSE(ictx, "Parsing input config file %s\n", file);
bstr_eatstart0(&data, "\xEF\xBB\xBF"); // skip BOM
int num = parse_config(ictx, false, data, file, (bstr){0}); int num = parse_config(ictx, false, data, file, (bstr){0});
MP_VERBOSE(ictx, "Input config file %s parsed: %d binds\n", file, num); MP_VERBOSE(ictx, "Input config file %s parsed: %d binds\n", file, num);
r = true; r = true;