Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Init decoder first and use later cause different behavior #5

Open
zhuguoliang opened this issue Aug 14, 2018 · 2 comments
Open

Init decoder first and use later cause different behavior #5

zhuguoliang opened this issue Aug 14, 2018 · 2 comments

Comments

@zhuguoliang
Copy link

image

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

@axgle
Copy link
Owner

axgle commented Oct 9, 2018

mybe your zip filename is encoded by gb18030,and your Terminal is utf-8 encoding

@ayanmw
Copy link

ayanmw commented Jun 29, 2021

image

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") 即可, 下面就可以直接使用.

低级错误.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants