From 3863221246d551353fdc9e2dd979cdc552c13d4a Mon Sep 17 00:00:00 2001 From: nanahi <130121847+na-na-hi@users.noreply.github.com> Date: Fri, 20 Sep 2024 03:32:54 -0400 Subject: [PATCH] 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. --- input/input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/input/input.c b/input/input.c index 655b6717d5..6d55b4f21e 100644 --- a/input/input.c +++ b/input/input.c @@ -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); goto done; } - stream_skip_bom(s); bstr data = stream_read_complete(s, tmp, 1000000); if (data.start) { 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}); MP_VERBOSE(ictx, "Input config file %s parsed: %d binds\n", file, num); r = true;