mahonia
mahonia copied to clipboard
Init decoder first and use later cause different behavior
if I do enc := ma.NewEncoder("gb18030") first and then print with enc.ConvertString(file1.Name) I would get Chinese garbled.
But if I just do ma.NewDecoder("gb18030").ConvertString(file1.Name) it works
mybe your zip filename is encoded by gb18030,and your Terminal is utf-8 encoding
if I do enc := ma.NewEncoder("gb18030") first and then print with enc.ConvertString(file1.Name) I would get Chinese garbled.
But if I just do ma.NewDecoder("gb18030").ConvertString(file1.Name) it works
既然你要 Decoder , 那么为什么 用 Encoder 来做对比呢????
上面 decer:=ma.NewDecoder("gb18030")
即可, 下面就可以直接使用.
低级错误.