From 5482f0be746a98bdd6b2c54183b54dd2ff2a0192 Mon Sep 17 00:00:00 2001 From: Phil Jones Date: Tue, 18 Oct 2022 19:33:41 +0100 Subject: Improve UTF-8 handling. This should allow case-insensitive matching for non-Latin characters, and fix matching for characters with diacritics. --- src/desktop_vec.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/desktop_vec.c') diff --git a/src/desktop_vec.c b/src/desktop_vec.c index df4218b..f559551 100644 --- a/src/desktop_vec.c +++ b/src/desktop_vec.c @@ -4,6 +4,7 @@ #include "fuzzy_match.h" #include "log.h" #include "string_vec.h" +#include "utf8.h" #include "xmalloc.h" static bool match_current_desktop(char * const *desktop_list, gsize length); @@ -42,7 +43,10 @@ void desktop_vec_add( vec->buf = xrealloc(vec->buf, vec->size * sizeof(vec->buf[0])); } vec->buf[vec->count].id = xstrdup(id); - vec->buf[vec->count].name = xstrdup(name); + vec->buf[vec->count].name = utf8_normalize(name); + if (vec->buf[vec->count].name == NULL) { + vec->buf[vec->count].name = xstrdup(name); + } vec->buf[vec->count].path = xstrdup(path); vec->buf[vec->count].keywords = xstrdup(keywords); vec->buf[vec->count].search_score = 0; -- cgit v1.2.3