From 330152fd5c4cf11488ac65e9024db8f8ce559d31 Mon Sep 17 00:00:00 2001 From: codytseng Date: Sat, 14 Mar 2026 13:21:13 +0800 Subject: [PATCH] fix: normalize Unicode in local user search for special characters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Apply NFKD normalization to both indexed text and search queries so that stylized Unicode characters (e.g. 𝚋𝚊𝚝𝚜𝚒𝚚) are decomposed to their ASCII equivalents and can be matched by search. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/services/client.service.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/services/client.service.ts b/src/services/client.service.ts index 2b2d902..0a08c55 100644 --- a/src/services/client.service.ts +++ b/src/services/client.service.ts @@ -1040,7 +1040,7 @@ class ClientService extends EventTarget { /** =========== Profile =========== */ async searchNpubsFromLocal(query: string, limit: number = 100) { - const result = await this.userIndex.searchAsync(query, { limit }) + const result = await this.userIndex.searchAsync(query.normalize('NFKD'), { limit }) return result.map((pubkey) => pubkeyToNpub(pubkey as string)).filter(Boolean) as string[] } @@ -1060,7 +1060,9 @@ class ClientService extends EventTarget { ?.split('@') .map((s: string) => s.trim()) .join(' ') ?? '' - ].join(' ') + ] + .join(' ') + .normalize('NFKD') if (!text) return await this.userIndex.addAsync(profileEvent.pubkey, text)