Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java, Archives, Linux & Cyrillic

I try to write an archiver in java, that creates TAR or ZIP archives, with correctly cyrillic file names, then it opened in linux. In windows I use org.apache.tools.zip, from ant:

ZipOutputStream.setEncoding("cp866"); 

to get it, but file roller (archive manager) in linux don't understand it. In org.apache.tools.tar method setEncoding() isn't exists. Also I try to use some other encoding, that supports Cyrillic, such a cp1251, utf-8, koi-8r but it gaves no result.

like image 718
strizhechenko Avatar asked Nov 28 '25 03:11

strizhechenko


1 Answers

Your file may be creating the files correctly and the problem lies on file-roller. It's known that it can't detect filename's encoding. See here and here.

Attempt to use unzip(filenames will probably be garbled) or p7zip directly from the shell (there is also a java version - j7zip).

7zip works for me, with utf8 encoding of Cyrillic characters. File roller, Ark, and all others that in fact execute unzip will corrupt the filenames in my system.

like image 137
Bruno Flávio Avatar answered Nov 30 '25 15:11

Bruno Flávio



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!