From 6c54681fe779a9bbea2a942c5fd93f86333cf994 Mon Sep 17 00:00:00 2001 From: Pierre Le Marre Date: Mon, 30 Oct 2023 12:31:42 +0100 Subject: [PATCH] Compose: Fix UTF-8 BOM detection The leading UTF-8 BOM detection code is misplaced as it is executed after each EOL. Fixed by moving the code before the goto labels. --- src/compose/parser.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compose/parser.c b/src/compose/parser.c index 6740f21..4112baa 100644 --- a/src/compose/parser.c +++ b/src/compose/parser.c @@ -527,6 +527,10 @@ parse(struct xkb_compose_table *table, struct scanner *s, enum { MAX_ERRORS = 10 }; int num_errors = 0; + /* Skip UTF-8 encoded BOM (U+FEFF) */ + /* See: https://www.unicode.org/faq/utf_bom.html#bom5 */ + scanner_str(s, "\xef\xbb\xbf", 3); + initial: production.len = 0; production.has_keysym = false; @@ -534,10 +538,6 @@ initial: production.mods = 0; production.modmask = 0; - /* Skip UTF-8 encoded BOM (U+FEFF) */ - /* See: https://www.unicode.org/faq/utf_bom.html#bom5 */ - scanner_str(s, "\xef\xbb\xbf", 3); - /* fallthrough */ initial_eol: