Projects STRLCPY afrog Commits 17445d6b
🤬
Revision indexing in progress... (symbol navigation in revisions will be accurate after indexed)
  • ■ ■ ■ ■ ■ ■
    pkg/utils/utils.go
    skipped 9 lines
    10 10   "strconv"
    11 11   "strings"
    12 12   "time"
     13 + "unicode/utf8"
    13 14   
     15 + "github.com/axgle/mahonia"
    14 16   "github.com/zan8in/afrog/pkg/proto"
    15 17  )
    16 18   
    skipped 176 lines
    193 195   return dst[:n]
    194 196  }
    195 197   
     198 +// 字符串转 utf 8
     199 +func Str2UTF8(str string) string {
     200 + if len(str) == 0 {
     201 + return ""
     202 + }
     203 + if !utf8.ValidString(str) {
     204 + return mahonia.NewDecoder("gb18030").ConvertString(str)
     205 + }
     206 + return str
     207 +}
     208 + 
Please wait...
Page is in error, reload to recover