shim.Error()中文输出像乱码,怎么解决?
来源:7-3 合约编写A

慕用4258747
2020-08-14
shim.Error()中文输出像乱码
示例:
if len(args) !=2 && len(args) !=1 {
mes :=fmt.Sprintf(“参数缺失,%v”,args)
return shim.Error(mes)
}
类似如下:
\260\255\265\347}\n/\346\nch)\210\342\343Y\3555)\325\312\325\360j\374\004\013\266\210\\336\n\022\223\001\n\200\001\0225
写回答
3回答
-
这只是显示缺失,因为是byte数组。你也可以先把中文转义了,用的时候再解
012020-08-14 -
慕用4258747
提问者
2020-08-14
问题是,我的mes 变量就是string类型,传给 shim.Error()的,还需要再转 string
00 -
慕用4258747
提问者
2020-08-14
能给例子不,我是新手入门,谢谢
022020-08-14
相似问题