From 35d03559c6802f90fda9fa00a2594d7cea8caf8f Mon Sep 17 00:00:00 2001 From: xiaoqidun Date: Fri, 9 Apr 2021 12:45:47 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=9F=A5=E8=AF=A2=E4=BC=98=E5=8C=96):=20?= =?UTF-8?q?=E5=89=94=E9=99=A4=E8=BF=94=E5=9B=9E=E7=BB=93=E6=9E=9C=E9=A6=96?= =?UTF-8?q?=E5=B0=BE=E7=A9=BA=E7=99=BD=E5=AD=97=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- qqwry.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qqwry.go b/qqwry.go index 4e37989..ccb3cd6 100644 --- a/qqwry.go +++ b/qqwry.go @@ -8,6 +8,7 @@ import ( "golang.org/x/text/transform" "io/ioutil" "net" + "strings" "sync" ) @@ -138,8 +139,8 @@ func QueryIP(queryIp string) (city string, area string, err error) { } } } - city = gb18030Decode([]byte(city)) - area = gb18030Decode([]byte(area)) + city = strings.TrimSpace(gb18030Decode([]byte(city))) + area = strings.TrimSpace(gb18030Decode([]byte(area))) ipCache.Store(queryIp, cache{City: city, Area: area}) return }