From 3c220e583130c86cdd19ab674fc4ef0fb3d477cf Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Fri, 26 Aug 2022 22:51:44 +0200 Subject: [PATCH] Fix calling utf8_in2 utf8_in2, when working in backward mode, is assuming that we are giving the address of the last byte of the previous character (see all other calls to utf8_in2). Otherwise, utf8_in2 returns the size of the current multibyte character instead of that of the previous multibyte character. --- src/libespeak-ng/dictionary.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libespeak-ng/dictionary.c b/src/libespeak-ng/dictionary.c index 906ff111..858fafbb 100644 --- a/src/libespeak-ng/dictionary.c +++ b/src/libespeak-ng/dictionary.c @@ -2084,7 +2084,7 @@ static void MatchRule(Translator *tr, char *word[], char *word_start, int group_ failed = 1; break; } - p -= utf8_in2(&letter_w, p, 1); + p -= utf8_in2(&letter_w, p-1, 1); } if (!failed) add_points = 3;