可以使用mahonia这个类库来进行转换

需要引入这个包

github.com/axgle/mahonia

 

最简单的使用方式如下:

result := mahonia.NewDecoder("gbk").ConvertString("你好")

相关文章: