From 315cdf7e4bc3cd0edededbf685347658e41960d8 Mon Sep 17 00:00:00 2001 From: fengdingbo <3217563+fengdingbo@users.noreply.github.com> Date: Sun, 20 Dec 2020 01:16:08 +0800 Subject: [PATCH] fix charset gbk and gb2312 --- common/httpx/title.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/httpx/title.go b/common/httpx/title.go index 926484e..d181798 100644 --- a/common/httpx/title.go +++ b/common/httpx/title.go @@ -20,7 +20,8 @@ func ExtractTitle(r *Response) (title string) { contentType := strings.Join(contentTypes, ";") // special cases - if strings.Contains(contentType, "charset=GB2312") { + if strings.Contains(strings.ToLower(contentType), "charset=gb2312") || + strings.Contains(strings.ToLower(contentType), "charset=gbk") { titleUtf8, err := Decodegbk([]byte(title)) if err != nil { return