Browse Source

清理特殊符号产生乱码

unknown 6 years ago
parent
commit
79a59b5457
2 changed files with 4 additions and 2 deletions
  1. 3 2
      src/jy/clear/specialsymbols.go
  2. 1 0
      src/specialsymbols.json

+ 3 - 2
src/jy/clear/specialsymbols.go

@@ -201,11 +201,12 @@ func RemoveAsymmetric(text string) string {
 		first := string(textRune[0])
 		last := string(textRune[len(textRune)-1])
 		if AsyReg.MatchString(first) {
-			text = text[1:]
+			textRune = textRune[1:]
 		}
 		if AsyReg.MatchString(last) && len(text) > 0 {
-			text = text[:len(text)-1]
+			textRune = textRune[:len(textRune)-1]
 		}
+		text = string(textRune)
 	}
 	return text
 }

+ 1 - 0
src/specialsymbols.json

@@ -16,6 +16,7 @@
 	},
 	"asymmetric":{
 		"field":{
+			"projectcode":true
 		},
 		"symbol":[
 			":",