From ae204b2a06d7c47bd9fae7f8ab9f330b5eefdfec Mon Sep 17 00:00:00 2001 From: CrystailX Date: Wed, 26 Feb 2025 00:56:00 +0800 Subject: [PATCH] Support non-Latin characters in library search function (#885) * support multilingual library search * prevent multiple spaces --- src/util/Strings.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/util/Strings.ts b/src/util/Strings.ts index f366c7e2..348e0b24 100644 --- a/src/util/Strings.ts +++ b/src/util/Strings.ts @@ -10,7 +10,8 @@ export const baseCleanup = (str: string) => str.toLowerCase().trim(); export const enhancedCleanup = (str: string): string => baseCleanup(str) - .replace(/[^a-zA-Z0-9\\s]+/g, ' ') + .normalize('NFKC') + .replace(/[^\p{L}\p{N}]+/gu, ' ') .trim(); export const reverseString = (str: string, separator: string = ''): string =>