From eed68a9a4d33dd633c2165c5e3c9d2f294ac0e31 Mon Sep 17 00:00:00 2001 From: Jurangren Date: Sat, 23 Aug 2025 03:29:01 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20VikaACG=20=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E7=BB=93=E6=9E=9C=E4=B8=AD=E7=9A=84=20Unicode=20?= =?UTF-8?q?=E8=BD=AC=E4=B9=89=E5=AD=97=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 解决 VikaACG 平台搜索结果中 `\uXXXX` Unicode 转义字符未正确解码的问题。 * 新增逻辑将 `\uXXXX` 转义序列转换为实际字符,确保搜索结果内容正确显示。 --- src/platforms/gal/VikaACG.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/platforms/gal/VikaACG.ts b/src/platforms/gal/VikaACG.ts index b155b7c..286b764 100644 --- a/src/platforms/gal/VikaACG.ts +++ b/src/platforms/gal/VikaACG.ts @@ -49,7 +49,10 @@ async function searchVikaACG(game: string): Promise { // .json() will parse the JSON and unescape the string content. const html: string = await response.text(); - const matches = html.replaceAll('\\/', '/').replaceAll('\\\\', '\\').replaceAll('\\"', '"').matchAll(REGEX); + const decodedHtml = html.replaceAll('\\/', '/').replaceAll('\\\\', '\\').replaceAll('\\"', '"').replace(/\\u([\d\w]{4})/gi, (match, grp) => { + return String.fromCharCode(parseInt(grp, 16)); + }); + const matches = decodedHtml.matchAll(REGEX); const items: SearchResultItem[] = []; for (const match of matches) {