|
@@ -9,6 +9,7 @@ import (
|
9
|
9
|
"gdyb/service"
|
10
|
10
|
"gdyb/utils"
|
11
|
11
|
"github.com/astaxie/beego"
|
|
12
|
+ "github.com/axgle/mahonia"
|
12
|
13
|
"math/rand"
|
13
|
14
|
|
14
|
15
|
|
|
@@ -3820,11 +3821,11 @@ const (
|
3820
|
3821
|
GB18030 = Charset("GB18030")
|
3821
|
3822
|
)
|
3822
|
3823
|
|
3823
|
|
-
|
3824
|
|
-
|
3825
|
|
-
|
3826
|
|
-
|
3827
|
|
-
|
3828
|
|
-
|
3829
|
|
-
|
3830
|
|
-
|
|
3824
|
+func ConvertToString(src string, srcCode string, tagCode string) string {
|
|
3825
|
+ srcCoder := mahonia.NewDecoder(srcCode)
|
|
3826
|
+ srcResult := srcCoder.ConvertString(src)
|
|
3827
|
+ tagCoder := mahonia.NewDecoder(tagCode)
|
|
3828
|
+ _, cdata, _ := tagCoder.Translate([]byte(srcResult), true)
|
|
3829
|
+ result := string(cdata)
|
|
3830
|
+ return result
|
|
3831
|
+}
|