中文切片乱码

This commit is contained in:
suguo.yao 2022-10-18 17:18:04 +08:00
parent f34f0948f4
commit 492974731a
1 changed files with 6 additions and 4 deletions

View File

@ -52,11 +52,13 @@ func siteAccess(uri *string) error {
}) })
//保持公平,长度限制 //保持公平,长度限制
if len(title) > 20 { str := []rune(title)
title = title[:20] if len(str) > 25 {
title = string(str[:25])
} }
if len(description) > 200 { str2 := []rune(description)
description = description[:200] if len(str2) > 200 {
description = string(str2[:200])
} }
if title != "" { if title != "" {