瀏覽代碼

Merge branch 'master' of http://git.shengws.com/csx/gdyb

csx 4 年之前
父節點
當前提交
d1d01526f3
共有 1 個文件被更改,包括 9 次插入8 次删除
  1. 9 8
      controllers/sz/sz_his_api_controller.go

+ 9 - 8
controllers/sz/sz_his_api_controller.go 查看文件

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