From 8800ced9f98eeef4f0e0628fa63179177b3f3cc4 Mon Sep 17 00:00:00 2001 From: Stephen Zhou <38493346+hyoban@users.noreply.github.com> Date: Fri, 18 Oct 2024 10:12:05 +0800 Subject: [PATCH] fix: encoding detect #955 --- apps/main/src/lib/readability.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/main/src/lib/readability.ts b/apps/main/src/lib/readability.ts index e0e9ebf10..6cd710cbe 100644 --- a/apps/main/src/lib/readability.ts +++ b/apps/main/src/lib/readability.ts @@ -17,7 +17,7 @@ export async function readability(url: string) { const contentType = res.headers.get("content-type") // text/html; charset=GBK if (!contentType) return res.text() - const charset = contentType.match(/charset=([^;]+)/)?.[1] + const charset = contentType.match(/charset=([a-zA-Z-\d]+)/)?.[1] if (charset) { const blob = await res.blob() const buffer = await blob.arrayBuffer()