fix: encoding detect

#955
This commit is contained in:
Stephen Zhou 2024-10-18 10:12:05 +08:00
parent 7e1767de10
commit 8800ced9f9
No known key found for this signature in database
1 changed files with 1 additions and 1 deletions

View File

@ -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()