Encoding errors when compressing files with Apache Commons Compression on Linux

≯℡__Kan透↙ 提交于 2019-12-04 13:07:35

I found a workaround for my trouble.

For some reason, java doesn't respects my environment's encoding, and change it to cp1252.

After that I uncompress the file, I just enter in it folder, and ran this command:

convmv --notest -f cp1252 -t utf8 * -r

And it converts everything recursively to UTF-8.

Problem solved, guys.

more info about encoding problems in linux here.

Thanks everyone for the help.

Derrek

FYI, there's a bug in the above code explained here: Tar problem with apache commons compress

Basically, you need to close the FileInputStream. IOUtils.copy() won't do it for you.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!